Log Rotation Setup
Configure logrotate for an 18 GB app log that has never been rotated.
A intermediate Linux challenge worth 10 points. Solve it hands-on in a real Linux environment in your browser - no local setup, no fake shells.
The Challenge
/var/log/app/api.log has grown to 18 GB. The disk is at 89%. The application keeps the file handle open — naive rotation breaks the log stream.
Your tasks:
- Write /etc/logrotate.d/api with: daily, rotate 14, compress, delaycompress,
missingok, notifempty, and a postrotate block that sends SIGHUP to the app process
- Test config: logrotate --debug /etc/logrotate.d/api
- Force rotation: logrotate -f /etc/logrotate.d/api
- Verify a rotated file (api.log.1 or api.log.1.gz) exists in /var/log/app/
- Run check to validate