Apache Log Rotation on Ubuntu Server

Interestingly, the log rotation utility rotatelogs which came with Apache does not work with Ubuntu 7.04 installation. At least not when the Apache is installed via apt-get.

By default, Ubuntu server utilizes logrotate not rotatelogs to rotate all its server logs. Appache access and error logs are rotated on a weekly basis when first installed. To change the log rotation frequency, you will need to change the following file: 

    /etc/logrotate.d/apache

The main difference between logrotate and rotatelogs is that logrotate is triggered by a cron job whereas rotatelogs runs in the background as a daemon. In Ubuntu, cron jobs are neatly organized into  cron.hourly, cron.daily, cron.weekly and cron.monthly folders. This makes creating ad-hoc cron jobs a very easy task.

Be Sociable, Share!

Leave a Reply