Re: suggested feature..

From: cougar <cougar@dont-contact.us>
Date: Fri, 25 Feb 2000 10:29:25 +1100 (EST)

On Thu, 24 Feb 2000, Michael Buchau wrote:

> Martin Brooks wrote:
> >
> > Just a thought for a future version of Squid. On the log rotation
> > front, how about a facility to time/date stamp and compress the log
> > file?
>
> No need to hack squid for that one. Assuming that you have set
> "logfile_rotate 0" in squid.conf, this little script should do the
> trick:
>
> #! /bin/sh
> LOGDIR=/var/squid/logs
> LOGFILES="access.log cache.log"
> datestr=`date '+%Y%m%d'`
>
> for f in $LOGFILES
> do
> mv $LOGDIR/$f $LOGDIR/$f-$datestr
> done
> squid -k rotate
> for f in $LOGFILES
> do
> gzip $LOGDIR/$f-$datestr
> done

Not meaning to beat up on your code, but newbies beware ...

It's probably not wise to go moving files around while the Squid process
is still using them (your first loop).

It _would_ be wise to signal the Squid process to rotate it's logs
_before_ any further manipulation via OS commands.

Also, in certain cases, admins may be rotating more frequently than once
per day, so you'll have multiple <access|cache>.log.<n> files laying
around.

Log management practice is so varied, that in most cases the problems will
be site specific.

J.

                     _______
+------------------ //////// -----+----------------------------+
| John V Cougar __ Big | Voice: 61 2 6208 1683 |
| Cache Manager / / /\ Pond +----------------------------+
| Telstra Internet \/_/ \ Direct | E-Mail: cougar@telstra.net |
+--------------------____/ -------+----------------------------+
Received on Thu Feb 24 2000 - 16:23:26 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:51:33 MST