generating sarg reports, and rotating squid logs.

Hi,

I am trying to set up a log rotation/report generating scheme for squid and sarg. Since I'm not real steady on the basics of logging and cron I was wondering if my plan will work or if anyone has a better idea on how I could do this.

1) newsyslog rotates the squid access.log on midnight to an uncompressed .0:
Code:
/var/log/squid/access.log      644  1     *    @T00  B     /var/log/squid/squid.pid  30

2) cron then runs sarg that generates report from the access.log.0 file 5 min later.
Code:
5 * * * * root sarg

3) newsyslog then archive the access.log.0 file an 5 min later.
Code:
/var/log/squid/acess.log.0              600  6     *    @T0010 BZ

Is this a good plan or am I oblivious to reason this won't work?
 
If my "cron-skillz" don't fail me, then your sarg-job will be run every five minutes. You need to tell it to run at a given hour aswell.
 
squids rotate function was real easy to use so i went with that.

now i rotate the squid logs at the start of every week and generate the sarg report 5 min later. i also rotate 10 time, giving me 10 weeks of logs. sarg makes reports based on access.log.0

Code:
# Rotate squid logs every monday at midnight
0      0       *       *       1       root squid -k rotate
# Generate a sarg report for the week 5 min after the files rotates
5      0       *       *       1       root    sarg
 
Code:
5 * * * * root sarg

Will run every 1hr at 5 minutes past (i.e For every value of hr when minute is 5, run)

Code:
*/5 * * * * root sarg

Will run every 5 minutes (i.e For every 5th value of minute, run)
 
problem

On Monday I got a not so happy mail from Cron Deamon that said my cron jobs failed.

Code:
squid: Permission denied
sarg: not found
/etc/crontab:
Code:
# Rotate squid logs every monday at midnight
0       0       *       *       1       root    squid -k rotate

# Generate a sarg report for the day 5 min after the file rotates
5       0       *       *       1       root    sarg

is the crontab wrong?
where do i start looking?
 
nice answer wblock@ :)
is there a way to test the crontab without waiting till next monday or changing the time?
 
Copy the entry, but change the time to be two minutes from now. Or you could simulate it by starting a new sh, setting the path as it is one line 6 of /etc/crontab, and running the command from there. The first is a more realistic test.
 
Back
Top