Automated Log Rotation & Cleanup
Keep disks healthy by automating log rotation and old-file cleanup with logrotate and scheduled find-based scripts.
The Problem of Growing Logs
Long-running services write logs forever. Without management they fill the disk and crash the system. Rotation and cleanup keep them in check.
du -sh /var/log/*What Log Rotation Does
Rotation renames the current log, starts a fresh empty one, and keeps a limited number of older compressed copies.
- app.log becomes app.log.1
- old copies get gzipped
- the oldest are deleted
All lessons in this course
- Scheduling Tasks with Cron
- Automating System Administration
- Advanced Scripting Project
- Automated Log Rotation & Cleanup