If you're like me, when a web access related problem strikes, my quickest path to diagnosing the issue is to open up Apache log files with vi or nano.

This happened to me the other day, and I was surprised to find that even though my logs rotate out weekly, the rotated files were still almost 1GB in size.

So, it got me thinking. Why do I have 4 log files, one for each of the past 4 weeks. When a problem strikes, I always solve it within 24 hours. Google analytics takes care of the traffic analysis.

I decided to opt for daily log rotation, and only keep the most recent 7 days. This will cut my log size down to 25% it's original size, and make them far less time and memory consuming to open via the command line.

A snippet from /etc/logrotate.conf

# rotate log files weekly
daily

# keep 4 weeks worth of backlogs
rotate 7

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *