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
|
Try:
Code:
rm /var/log/squid/access.log After deleting the logfile don't forget to reload squid Regards |
echo > /var/log/squid/access.log
|
You can use "sbin/squid -k rotate" ... it will rotate access.log to access.log.0 and access.log will be fresh.
|
Quote:
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 |
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 |
Quote:
|
All times are GMT -5. The time now is 01:52 AM. |