LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-23-2010, 10:13 AM   #1
aliabbass
Member
 
Registered: Jun 2008
Posts: 57

Rep: Reputation: 0
deleting squid access logs


Is there any way to delete squid proxy access logs if someone knows then please share how can the access logs be deleted
 
Old 12-23-2010, 05:42 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,220
Blog Entries: 1

Rep: Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074
Try:
Code:
rm /var/log/squid/access.log
If access.log is located somewhere else check squid.conf to find its actual location.
After deleting the logfile don't forget to reload squid

Regards
 
Old 12-24-2010, 12:31 AM   #3
kaushalpatel1982
Member
 
Registered: Aug 2007
Location: INDIA
Distribution: CentOS, RHEL, Fedora, Debian, Ubuntu, LinuxMint, Kali Linux, Raspbian
Posts: 166

Rep: Reputation: 10
echo > /var/log/squid/access.log
 
Old 12-24-2010, 01:53 AM   #4
getviswa
LQ Newbie
 
Registered: May 2010
Posts: 23

Rep: Reputation: 0
You can use "sbin/squid -k rotate" ... it will rotate access.log to access.log.0 and access.log will be fresh.
 
Old 12-24-2010, 01:57 AM   #5
aliabbass
Member
 
Registered: Jun 2008
Posts: 57

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
Try:
Code:
rm /var/log/squid/access.log
If access.log is located somewhere else check squid.conf to find its actual location.
After deleting the logfile don't forget to reload squid

Regards
well i am sorry i did n't explain the whole scenario
what i want is to delete logs of particular ip i mean system that is using squid as a proxy and i want to delete the access logs of that particular system on particular date like Dec 23
i hope that every body will now understand the problem
 
Old 12-24-2010, 04:02 AM   #6
getviswa
LQ Newbie
 
Registered: May 2010
Posts: 23

Rep: Reputation: 0
You can use this script
#1- pass the argument like "Jan 1 172.16.1.45"
#2- it will create temp.log -- u just delete access.log and rename temp.log to access.log


#! /usr/bin/perl
open INPUTFILE, "<", "access.log" or die $!;
open OUTPUTFILE, ">", "temp.log" or die $!;
$m_=$ARGV[0];
$d_=$ARGV[1];
$ip_=$ARGV[2];
while (<INPUTFILE>) {

@textline=split(" ",$_);


#print "@textline[0] @textline[2] \n";
@time=split(" ",localtime(@testline[0]));
if((@time[1] eq $m_ ) && (@time[2] eq $d_) && (@textline[2] eq $ARGV[2]))
{
$flag=1;
}
if($flag==0)
{
print OUTPUTFILE $_;
}
$flag=0;

}



Thank
-Viswa
 
Old 12-30-2010, 12:01 AM   #7
aliabbass
Member
 
Registered: Jun 2008
Posts: 57

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by getviswa View Post
You can use this script
#1- pass the argument like "Jan 1 172.16.1.45"
#2- it will create temp.log -- u just delete access.log and rename temp.log to access.log


#! /usr/bin/perl
open INPUTFILE, "<", "access.log" or die $!;
open OUTPUTFILE, ">", "temp.log" or die $!;
$m_=$ARGV[0];
$d_=$ARGV[1];
$ip_=$ARGV[2];
while (<INPUTFILE>) {

@textline=split(" ",$_);


#print "@textline[0] @textline[2] \n";
@time=split(" ",localtime(@testline[0]));
if((@time[1] eq $m_ ) && (@time[2] eq $d_) && (@textline[2] eq $ARGV[2]))
{
$flag=1;
}
if($flag==0)
{
print OUTPUTFILE $_;
}
$flag=0;

}





Thank
-Viswa
thanks viswa for providing this useful script
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] how long are the squid logs kept for? qwertyjjj Linux - Software 4 08-10-2009 11:09 AM
squid logs analyzer adam_blackice Linux - Server 5 04-01-2009 05:06 AM
[SOLVED] ClamAV deleting logs Mogget Linux - Server 1 03-24-2009 07:39 PM
Accessing Squid logs jonnoc Linux - General 2 01-16-2008 09:33 AM
Squid Access Logs date wise the_gripmaster Linux - Software 1 10-03-2007 10:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration