Install log cleanup and logfile reporting on Ubuntu 24.04 server.
Not a demo, not a quick hack.
This script is built for production systems and safe unattended execution.
---
## Why this installer exists
Ubuntu systems accumulate rotated logfiles over time.
While `logrotate` handles rotation, old rotated logs are not automatically removed, and custom or installer-generated logs can grow unnoticed.
Disk space is rarely the real problem.
Operator clarity is.
An unmanaged `/var/log` directory becomes noisy over time and increases the risk of misreading timestamps or confusing old incidents with new ones during troubleshooting — especially under pressure.
In environments without centralized log storage, keeping `/var/log` clean ensures it remains a usable, live operational workspace.
---
## What this script does
✔ Scans `/var/log` recursively
✔ Deletes classic rotated logfiles created by logrotate
✔ Detects and reports large unrotated logfiles
✔ Detects non-logrotate numeric logfiles (installer and debug logs)
✔ Writes a full execution report to a logfile
✔ Designed for unattended cron execution
---
## What this script does NOT do
It won’t stop you from running the script without reading the documentation like there’s no tomorrow.
Skip the README, and whatever happens next is your headache, not a bug report.