Rules Related To 'logrotate'

Component overview

Relevant packages:

Relevant groups:

None

Changelog:

No changes recorded.

Relevant rules:

Rule details

Ensure logrotate is Installed

package_logrotate_installed

Description

logrotate is installed by default. The logrotate package needs to be present in the container or container image.

Rationale

The logrotate package provides the logrotate services.

Ensure Logrotate Runs Periodically

ensure_logrotate_activated

Description

The logrotate utility allows for the automatic rotation of log files. The frequency of rotation is specified in /etc/logrotate.conf, which triggers a cron task or a timer. To configure logrotate to run daily, add or correct the following line in /etc/logrotate.conf:

# rotate log files frequency
daily

Rationale

Log files that are not properly rotated run the risk of growing so large that they fill up the /var/log partition. Valuable logging information could be lost if the /var/log partition becomes full.

Enable logrotate Timer

timer_logrotate_enabled

Description

The logrotate timer can be enabled with the following command:

$ sudo systemctl enable logrotate.timer

Rationale

Log files that are not properly rotated run the risk of growing so large that they fill up the /var/log partition. Valuable logging information could be lost if the /var/log partition becomes full.