The Problem
The system log /var/log/messages are getting trimmed or deleted automatically, and the old log will not be rotated to messages.1, messages.2, or so.
The Solution
The system log will be rotated by the logrotate, a cron job scheduled daily. This problem is due to an incorrect logrotate configuration. Checking the logrotate configuration file /etc/logrotate.conf below:
# rotate log files weekly #weekly # keep 40 weeks worth of backlogs #rotate 40
the rotation interval/times are all commented out. With this setting, the system log is trimmed without rotation.
In order to avoid this, modify the /etc/logrotate.conf and specify a proper rotation interval. For example, the configuration below:
weekly rotate 4
This will rotate the logs weekly, and log files will be rotated four times before being overwritten. For more information on logrotate, check the man page:
# man logrotate