Skip to content
Calcrivo

Log Rotation Size Calculator

Calculate total disk space consumed by rotated log files based on logrotate retention policy.

Inputs

MB

e.g. logrotate 'rotate 14' for two weeks of daily logs

%

Expected log volume growth from one rotation to the next

Compressed size as a fraction of original, e.g. 0.15 for gzip on text logs

Total Storage (uncompressed)

7,986.97MB

Total Storage (compressed)

1,198.05MB

Storage Saved by Compression

6,788.92MB

Storage Savings

85.00%

Step by step

  1. Values used

    Current Log Size (per rotation period) = 500 MB; Number of Rotations Kept = 14; Growth Rate per Rotation = 2 %; Compression Ratio = 0.1500

  2. Total storage across rotations

    total_storage = Σ log_size × (1 + growth_rate)^i for i = 0 to rotations-1

  3. Total Storage (uncompressed)

    = 7,986.97 MB

  4. Total Storage (compressed)

    = 1,198.05 MB

  5. Storage Saved by Compression

    = 6,788.92 MB

  6. Storage Savings

    = 85.00

How it works

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.

Formula

Total storage across rotations

total_storage = Σ log_size × (1 + growth_rate)^i for i = 0 to rotations-1

S
current log size per rotation
g
growth rate per rotation
n
number of rotations kept

Frequently Asked Questions

How much does gzip typically compress log files?

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.

Why does logrotate leave the most recent log uncompressed?

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.

How do I account for multiple log files (e.g. access + error logs)?

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.

You might also need