About Log Manager

The Log Manager uses the Logrotate utility to manage the server log files. Depending on the frequency and size of the log files, Logrotate 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 of 10 to 20 MB in size. Over time, such log files consume a great deal of disk space if they are not compressed and rotated on a regular basis.

# How Logrotate works

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

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.

- Note: Before Logrotate is scheduled to run, the system generates Webalizer and Analog log reports.

By default, logs are compressed and placed in an archive file.

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 are written to the access-log file, which is now your current log 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 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, you may want to consider the following factors.

- Amount of available disk space

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

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

- Important: If your server runs out of disk space and a log rotate is scheduled to run, you will lose important log data.

- Log size and traffic level

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

- Frequency of rotation

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.