Forum Moderators: phranque

Message Too Old, No Replies

Archiving of Log Files on Apache

         

ukgimp

11:41 am on Jan 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is there a simple way to archive logfiles. Currently I have logrotate at my disposal but it falls short of what I would like to do as it deletes the files every four cycles. Can anyone recommend a script that can be run on a periodic basis that processes the most recent logs with a stats package (eg webalizer) and then opens up a compressed archive logfile, then adds the new data in and then re-compresses the archive. Then once the compression is complete delete the logfile to start a new one.

I am pretty sure this can be done as it was set up to happen on a host that I once used. Any pointers most appreciated.

Cheers

dcrombie

11:54 am on Jan 5, 2004 (gmt 0)



With logrotate and webalizer running you can do all of that. Check the manpages for logrotate for some examples - you will need to use delaycompress and postrotate to get webalizer working properly.

ukgimp

12:07 pm on Jan 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



All getting a bit heavy for me this apache stuff. Thanks for your response dcrombie :)

If I could be so cheeky as to ask if I am nearly there with this as in the logrotate configuration file:

/www/logs/mysite/access.log {
rotate 4
daily
compress
prerotate
/usr/bin/webalizer -N 5 -Q -c /usr/local/etc/webalizer/mysite.co.uk
/bin/true
endscript
}

dcrombie

12:49 pm on Jan 5, 2004 (gmt 0)



You might want to set rotate 30 so you keep logs for about a month. I'm also not sure if /bin/true is required.
You can run logrotate with the -d option to perform a dry-run with commentary to see what it would have done.