Logrotate Errors — Log Rotation Configuration and Permission Failures on Linux
Informationalsystem
Overview
Fix Linux logrotate errors including configuration syntax failures, permission denied during rotation, and logs not being rotated as expected.
Key Details
- Logrotate manages log file rotation, compression, and deletion based on configuration rules
- Configuration files: /etc/logrotate.conf (global) and /etc/logrotate.d/ (per-application)
- Logrotate runs daily via systemd timer or cron — check scheduling if logs are not rotating
- The 'copytruncate' directive is needed for applications that hold log files open (cannot be renamed)
- SELinux contexts on log files can prevent logrotate from operating correctly
Common Causes
- Configuration syntax error preventing logrotate from processing rules
- Logrotate cron job or systemd timer not running
- Permission issues — logrotate running as root but log files owned by application user
- Application holding log file open — rename-based rotation creates a new file the app does not write to
Steps
- 1Test configuration: 'logrotate -d /etc/logrotate.conf' to debug without actually rotating
- 2Force rotation: 'logrotate -f /etc/logrotate.d/myapp' to test rotation immediately
- 3Check the timer: 'systemctl status logrotate.timer' or 'cat /etc/cron.daily/logrotate'
- 4Use 'copytruncate' for apps that hold files open: it copies the log and truncates the original in place
- 5Fix SELinux: 'restorecon -rv /var/log/myapp/' to reset log file security contexts
Tags
logrotatelog-rotationlog-managementcronsysadmin
More in System
windows-C000021A-status-system-process-terminatedWindows Error 0xC000021A — STATUS SYSTEM PROCESS TERMINATED
Criticalwindows-C0000225-boot-configuration-errorWindows Error 0xC0000225 — Boot Configuration Error
Criticalwindows-C000000F-boot-selection-failedWindows Error 0xC000000F — Boot Selection Failed
Criticalwindows-80004005-unspecified-errorWindows Error 0x80004005 — Unspecified Error
Warningwindows-80070570-file-or-directory-corruptedWindows Error 0x80070570 — File or Directory Corrupted
Errorwindows-system-0xc0000185Windows Error 0xC0000185 — Boot Device Inaccessible
CriticalFrequently Asked Questions
Use 'create' (default) when the application can reopen log files after rotation (e.g., via SIGHUP). Use 'copytruncate' when the application keeps the log file open and cannot be signaled to reopen.