I just use a shell script to rotate logs:
#!/bin/bash
# Shell script for rotating squid logfiles
timestamp=$(date +%y%m%d%H)
filename="ex$timestamp.log"
mv /usr/local/squid/var/logs/access.log /var/squidlogs/$filename
/usr/local/squid/sbin/squid -k rotate
...and then run it regularly by putting something in crontab:
# rotate logs once an hour
0 * * * * /usr/sbin/log_rotate.sh
-----Original Message-----
From: Mark Elsen [mailto:mark.elsen@gmail.com]
Sent: Saturday, March 25, 2006 5:08 AM
To: lawrence wang
Cc: squid-users@squid-cache.org
Subject: Re: [squid-users] rotate bug?
> hi, i was testing out squid -k rotate on squid-2.5STABLE12, and i
> notice that cache.log and store.log rotate ok (*.0 files are created),
> but access.log doesn't; furthermore, if i restart the server,
> access.log is emptied, so i lose my old logs.
>
> if i rename the file after running rotate, it will keep writing to
> that one and then write to a new file after restart.
>
> my access.log is named "squid_access.log" and it's in a non-standard
> location; maybe that's why?
>
It can perfectly be in a none standard location , if so configured and or
you are using log pointer directives in squid.conf.
Is there anything in cache.log , when yoy try to rotate ?
Look both in the end of the before-rotated cache.log (tail-ed) and in
in the beginning
of the new (head-ed) one.
M.
Received on Sat Mar 25 2006 - 16:10:05 MST
This archive was generated by hypermail pre-2.1.9 : Sat Apr 01 2006 - 12:00:04 MST