Overview
I set up automatic log rotation with logrotate, including how many old logs to keep, compression and creating a new active log.
What I set out to do
- Stop log files from growing without limit.
What I did
- I confirmed the logrotate timer was running.
- I wrote my own rotation policy and tested it.
Screenshots
They are in the same order as in my repository. Click one to see it full size.
1. Logrotate Status and ConfigurationShows logrotate installed, the scheduled timer active and existing rotation policies. 2. Logrotate Policy ValidationShows the custom log rotation policy and successful configuration validation. 3. Log Rotation and CompressionShows the log being rotated, compressed historical logs being retained and a new active log being created.
How I tested it
- The log was rotated and compressed, older logs were kept and a new active log was created.
Repository
My full notes and the original screenshots are on GitHub: linux-projects/12-log-rotation-logrotate