How to check Logrotate status
Check the Logrotate state file to verify that log rotation runs on schedule and confirm the last rotation timestamp for each log file.
Check the Logrotate state file to confirm that log rotation runs correctly and to see when each log file was last rotated.
Prerequisites
- Linux system with Logrotate installed.
- Read access to
/var/lib/logrotate/status(root or sudo).
Step-by-Step: Check Logrotate Status
View the Logrotate state file to see the last rotation timestamp for every configured log file:
cat /var/lib/logrotate/statusLogrotate stores one line per log file with the date of its last rotation. The output looks like:
logrotate state -- version 2 "/var/log/nginx/access.log" 2026-3-7-0:0:0 "/var/log/nginx/error.log" 2026-3-7-0:0:0 "/var/log/syslog" 2026-3-8-0:0:0 "/var/log/auth.log" 2026-3-1-0:0:0Each entry shows the full path and the timestamp of the last rotation in
YYYY-M-D-H:M:Sformat.Filter the Logrotate state file for a specific application log to check its rotation status:
grep nginx /var/lib/logrotate/statusLogrotate displays only lines matching the application name.
Run Logrotate in debug mode to simulate rotation and verify that the configuration processes correctly:
sudo logrotate -d /etc/logrotate.confLogrotate prints the actions it would take without modifying any files. Review the output for errors or skipped files.
How to Verify Logrotate Status Check Was Successful
Logrotate state file entries with recent dates confirm that rotation runs on schedule. Compare the timestamps against the expected rotation frequency (daily, weekly, or monthly).
If a log file shows an old timestamp, the rotation schedule may be misconfigured. Run
logrotate -d /etc/logrotate.d/{YOUR_APP} to debug that specific configuration.
Common Issues When Checking Logrotate Status
State file does not exist.Logrotate creates the state file after its first run. If
/var/lib/logrotate/status is missing, Logrotate has never executed. Check that the cron job at
/etc/cron.daily/logrotate exists or that the systemd timer
logrotate.timer is active.
State file path differs between distributions.Some distributions store the state file at
/var/lib/logrotate/logrotate.status or
/var/lib/logrotate.status. Search for it with:
find /var/lib -name "*logrotate*status*"Timestamps are stale.If all entries show old dates, the cron daemon (crond) may not be running. Check with
systemctl status cron on Ubuntu or
systemctl status crond on RHEL-based systems.