How to clear squid log manually in centOS/RHEL
In this post i am going to delete/clear squid log manually.
Method:1 - Fast way to delete squid log (later you can delete directory squid.old )
#cd /var/spool/
#mv squid squid.old
#mkdir squid
#chown squid.squid squid
#ls -ld squid
drwxr-xr-x 18 squid squid 4096 Feb 5 03:06 /var/spool/squid
Restart service, after restarting server cache directory create automatically
#service squid restart
Verify that user are accecing internet or not
# tail -f /var/log/squid/access.log
1486304781.472 301076 192.168.0.5 TCP_MISS/304 231 POST http://spoc-pool-gtm.norton.com/register? - DIRECT/40.114.95.106 -
1486305112.332 300788 192.168.0.5 TCP_MISS/304 231 POST http://spoc-pool-gtm.norton.com/register? - DIRECT/40.114.95.106 -
Method:1 - Fast way to delete squid log (later you can delete directory squid.old )
#cd /var/spool/
#mv squid squid.old
#mkdir squid
#chown squid.squid squid
#ls -ld squid
drwxr-xr-x 18 squid squid 4096 Feb 5 03:06 /var/spool/squid
Restart service, after restarting server cache directory create automatically
#service squid restart
Verify that user are accecing internet or not
# tail -f /var/log/squid/access.log
1486304781.472 301076 192.168.0.5 TCP_MISS/304 231 POST http://spoc-pool-gtm.norton.com/register? - DIRECT/40.114.95.106 -
1486305112.332 300788 192.168.0.5 TCP_MISS/304 231 POST http://spoc-pool-gtm.norton.com/register? - DIRECT/40.114.95.106 -
Method:2
# cd /var/spool/squid
# ls
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F swap.state
# rm -rf *
#service squid restart
# ls
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F swap.state
Method:3- Using script
Create a file name as squidclear.sh
#cat squidclear.sh
# cat squidlogclear.sh
#/bin/bash
rm -rf /var/spool/squid/*
rm -rf /var/log/squid/*.gz
echo >/var/log/squid/access.log
echo >/var/log/squid/cache.log
echo >/var/log/squid/squid.out
echo >/var/log/squid/store.log
squid -z
service squid restart
Make script executable
#chmod o+x squidclear.sh
Run scrip
# ./squidclear.sh