log2rotate

log2rotate is designed to rotate backups with an optimal balance between retention and space usage. Instead of rotating backups using some familiar method such as daily, weekly, monthly, and yearly periods, it rotates backups using exponentially-growing periods. The exponential periods are based on the base 2 logarithm (log2x) or squaring (x2), depending on how you look at it.

log2rotate makes the guarantee that the distance between the nth and (n+1)th backups will be no greater than twice the distance between the (n-1)th and nth backups. The optimal is periodically achieved. For example, on the 64th rotation, log2rotate will recommend retaining the backups numbered: 1, 2, 4, 8, 16, 32, and 64.

Backup periods for a daily-weekly-monthly-yearly schedule over 1 year
Index 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Day 1 2 3 4 5 6 7 14 28 35 65 95 125 155 185 215 245 275 305 335 365
Backup periods for a log2rotate schedule over 1 year
Index 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Day 1 2 3 5 9 13 21 29 45 77 109 173 237 365

The latest source is available on github.