Re: [squid-users] newbie syslog.conf and coss questions

From: Chris Robertson <crobertson@dont-contact.us>
Date: Fri, 04 Apr 2008 11:23:43 -0800

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
Received on Fri Apr 04 2008 - 13:24:00 MDT

This archive was generated by hypermail 2.2.0 : Thu May 01 2008 - 12:00:04 MDT