Calculate total disk space consumed by rotated log files based on logrotate retention policy.
logrotate keeps a configurable number of past log rotations on disk, and log volume typically grows over time as traffic increases. Summing the log size across all retained rotations — compounding a per-rotation growth rate — gives the worst-case uncompressed storage footprint. Since logrotate can compress all but the most recent rotation(s), applying a realistic compression ratio (commonly 10-20% of original size for repetitive text logs under gzip) shows the practical storage savings.
Total storage across rotations
total_storage = Σ log_size × (1 + growth_rate)^i for i = 0 to rotations-1
Plain-text logs with repetitive structure (timestamps, common field names, repeated error strings) often compress to 10-20% of their original size under gzip, though highly variable content like binary dumps compresses less.
The active or most recently rotated log is often left uncompressed briefly so tools like `tail -f` or log shippers can still read it easily; compression is applied on the next rotation cycle via the 'delaycompress' option.
Run this calculator once per log file (or sum their current sizes together if they grow at similar rates) since each logrotate-managed file accumulates storage independently based on its own size and retention count.