About Log Manager

The Log Manager uses the Logrotate utility to manage the server log files. When log files reach an established size, Logrotate automatically archives the log data. The system then populates the empty log file with fresh log data. This is called log rotation.

Why logs need to be rotated

Log files, on a busy server, grow very quickly. A server that receives 100,000 requests a day could generate an access-log file 10-20 MB in size. Over time, such log files would consume a great deal of disk space if they were not compressed and rotated on a regular basis.

How Logrotate works

Logrotate compresses and rotates logs based on thresholds for size and frequency. You set these thresholds when you configure Logrotate. Thresholds are saved in the configuration file, logrotate.conf, located within the file system of the site for which you configured Logrotate.

When the log file reaches the set thresholds, Logrotate archives it in the same directory. The system then writes new log data to the empty log file.

By default, logs are compressed and placed in an archive file. You can set Logrotate to archive uncompressed files, however.

For example, if the access-log file for the server has reached the rotate threshold, then it is compressed as an access-log.gz file and fresh logs written to the access-log file, which is now your current log file.

For example, if the access-log file for the server has reached the rotate threshold, then a new file, access-log.1 is created into which the existing log data is archived, and fresh log data written to the access-log file, which is now your current log file.

Factors to consider when configuring log rotation

When you configure log rotation, consider the following key factors.

The disk space allocated to your site is key to determining the threshold that you need to set for your log files. If your site has limited disk space, you will need to set a lower threshold.

If your server runs out of disk space, system performance drops, and you lose fresh log data.

On high-traffic sites, log files grow quickly. Consider your site's traffic level and the expected log file size when setting your log threshold.

Logs can be rotated four times daily, once a day or weekly, depending on the rate at which log files expand. In general, high-traffic sites require more frequent rotation than low-traffic sites.

Related Topics