goutte
goutte copied to clipboard
Enable more complex retention policies
It would be nice, to be able to set multiple retention "scope" like, keep:
- One Snapshot for the last seven days (each day)
- one Snapshot for the last four weeks (one Snapshot of each week)
- one Snapshot for the last twelve months (one snapshot of each month)
That could be nice to add indeed! As a workaround for now it is possible to achieve this by having multiple config files and running the goutte once per config.
This was my first idea. But wouldn't my weekly config with retention=4 prune some of my weekly snapshots with retention=7, since there is no differentiation in the prefixes?
Ah yes you're right, sorry it's been a while! I will see to refactor goutte to accept something like:
[droplets]
default_retention = 5
[[droplets.by_name]]
name = "server01"
retention = 3
[[droplets.by_name]]
name = "server02"
[[droplets.by_tag]]
tag = "prod"
retention = 20
[volumes]
[[volumes.by_name]]
# ...
Oh I see I have described my idea a bit vaguely. I didn't mean different retentions for different volumens/droplets (this is also a really nice feature to have), but to have gaps between retentions of the same item.
For example I have a volume my_volume. For this volume I want multiple snapshots within the following timeframe:
- 7 snapshots from the last seven days (Mo, Tu, We, Th, Fr, Sa, Su)
- 4 snapshots from the last 4 weeks (Su, Su, Su, Su)
- 12 snapshots from the last 12 Months (01.01., 01.02., 01.03. etc.)
So if I want to store a 10 month old snapshot, I don't have to keep 200 snapshots. At full retention this would only store 21 Snapshots (7+3+11)
Does that explanation make the idea a bit clearer? It's kinda hard to describe.
Ah yes I see, totally makes sense!
One simple way to do it in conjuction with my change proposed above would be to update the snapshot naming to something like goutte-{??}-{droplet}-{date}-{hash}
.
???
could be either the name of the config file or a name
parameter from the config.
That would let you run:
- daily
goutte daily.toml
which would creategoutte-daily-server01-{date}-{hash}
with retention of 7 - weekly
goutte weekly.toml
which would creategoutte-weekly-server01-{date}-{hash}
with retention of 4 - etc
Another way would be to completly change the internal logic, and define it in a cron style and jobs should check existing snapshots, compare it to the actual time and decide if it should start a snapshot. But that seems clunky as it's not a constantly running software.
A yeah I see. So your first suggestion would work like a charm. Would really appreciate, if it was implemented. Thank you!
Will be reworked in a new version 2