Keep vs keep-within

My understanding from the documentation can be illustrated with an example. Let’s assume we have snapshots (with pseudo-IDs a0-9):

  • a1 on May 1st 8 a.m.
  • a2 on May 2nd 8 a.m.
  • a3 on May 2nd 11 a.m.
  • a4 on May 4th 9 a.m.
  • a5 on May 5th 10 a.m.

Running forget on May 5th at noon, the two options will do this:

  • --keep-daily 4 keeps the last 4 daily snapshots on days which have a snapshot but only one per day. a5 and a4 obviously, there is nothing on May 3rd, then the latest from May 2nd, i.e. a3 and a1: a1, a3, a4, a5. (4 snapshots)
  • --keep-within-daily 4d keeps only snapshots within the last 4 days. This is similar but not identical. The time range is from May 1st 10 a.m. to May 5th 10 a.m. (last snapshot). a1 is outside of that range. Again, only one snapshot per day, forgetting a2. So the retained snapshots are: a3, a4, a5. (3 snapshots)

In short: with keep-daily 4 you get 4 snapshots. With keep-within-daily 4d you get one per day for the last 4 days. If you have >= 1 snapshots per day at the same times, it should be pretty much the same.