As part of my ongoing efforts to make sites on this server run faster and cause me fewer headaches I’ve implemented Apache log rotation using Cronolog.
Apache2 does support log rotation, but Cronolog gives you more options, which is why I chose it.
On Ubuntu all you need to do is:
apt-get install cronolog
To see which version you have type:
cronolog -V
The version I have is 1.6.2, which was released 5 years ago! I guess that means “it just works”.
Unfortunately the documentation on the site isn’t as extensive as I would have liked, but adding a daily log rotation in Apache2 can be done by editing the log entry in the vhost config to read as follows:
CustomLog "|/usr/sbin/cronolog /pathtologs/logs/%Y/%m/%d/access.log" combined
This will create a subdirectory for each year, month and day. As the site I was concerned about, IrishBlogs.info, produces rather large log files I was more concerned about getting them down to a managable size. I am not worried about processing them at this juncture.
Hopefully this will help 🙂







Leave a Reply