garethgeorge/backrest

Retention by count and time period

Opened this issue · 1 comments

If backups run every 10 minutes and retention is set by time period eg with hourly = 24 the immediately previous backup from 10 minutes ago is deleted. I want to keep the last 6 (or x) backups and hourly after that, plus any further day, week, month, year setting.

This could be achieved by allowing rention to be set both by count and by time period at the same time. If retention by count is set to x then that many of the most recent backups would be kept and any additional backups deleted UNLESS those backups would otherwise be kept based on the retention by time period setting. In other words only delete backups that don't meet either retention policy.

Interesting, it hadn't ever occurred to me that there's a use case for --keep-last-n and --keep-hourly etc in combination but this makes plenty of sense and support is relatively straightforward to add though it may take me a few versions to get to this. (edit: I'm assuming that you're coming from restic / know that these flags do actually work together -- I'll aim to test when I have some time).

Will track popularity of this FR in the meantime for my prioritization.