3.4 Ensure log files are rotated - rotate

Warning! Audit Deprecated

This audit has been deprecated and will be removed in a future update.

View Next Audit Version

Information

Log rotation ensures log files do not consume excessive disk space, potentially causing a denial of service.

Rationale:

Log files are important to track activity that occurs on your server, but they take up significant amounts of space. Log rotation should be configured in order to ensure the logs do not consume so much disk space that logging becomes unavailable.

Solution

Follow the below procedure to change the default configuration to the recommended log rotation configuration. You may need to manually edit or change the below command if the configuration is not the default.

To change log compression from daily to weekly:

sed -i 's/daily/weekly/' /etc/logrotate.d/nginx

To change log rotation from every year to every 13 weeks:

sed -i 's/rotate 52/rotate 13/' /etc/logrotate.d/nginx

See Also

https://workbench.cisecurity.org/files/2275