Amos Jeffries wrote:
B. Cook wrote:
Morning all,


2) regarding syslog.conf and file rotation

I know I can setup -k rotate from cron and that will rotate squid's current cache_log, but how would I compress it?

To compress it you would need a wrapper script which runs runs the -k rotate, then compresses the resulting access_log.0 into a new filename (usually dated files is a good idea).


For posterity sake, here's the script that I use:

#!/bin/sh
# Tell squid to rotate logs
/usr/local/squid/sbin/squid -k rotate
# Situate ourselves in the log directory
cd /usr/local/squid/logs/
# Move the old logs (overwriting number 5)
mv -f access.log.4.gz access.log.5.gz
mv access.log.3.gz access.log.4.gz
mv access.log.2.gz access.log.3.gz
mv access.log.1.gz access.log.2.gz
mv access.log.0.gz access.log.1.gz
# Compress the most recent squid log
/bin/gzip access.log.0

It's nothing fancy, but it gets the job done. Just make sure your logfile_rotate (in squid.conf) is not set to 0.


I have looked back through the gmane archives of squid-users and I do not see anyone that answered this question directly.. and even a google search didn't turn up much of anything useful. Or am I just missing something basic with a syslog.conf parameter?

thanks in advance and I am sorry if another form of these questions were asked/answered; I couldn't find anything like them.

again thanks in advance

Amos

Chris

Reply via email to