Flexibility of --group-by

Hi guys,

first of all, thank you for a brilliant backup tool!
My question relates to the flexibility of the --group-by function for the snapshots command. A short explanation: in my setup, i have various backup tasks (each with an ID) and each time a task executes (a task execution), it performs a restic backup command and each snapshot is tagged with the ID of the backup task and the ID of the task execution (thus each snapshot will have two tags, e.g. “backup-task-2” and “task-execution-11”).

Now, before each execution, I need to determine the snapshot ID of the last task execution so that I can set that as the parent for the new snapshot to be created. Since the paths to be backed up for a backup task can change over time, I must set the parent manually as otherwise the parent would be based on the paths (which can change between task executions).

Thus, to find the latest snapshot for backup task with for example ID = 2, I cannot group by tags or by paths, so therefore I need to run

restic snapshots --tag backup-task-2 --group-by host --last

Now, if ever I need to rename my machine, this method will fail as it will output multiple snapshots for multiple hostnames.

Possible ways in which restic could help to solve such problems:

  • allow specifying hostname manually for backup command or changing hostname of existing snapshots
  • when specifying both --group-by tags as well as a --tag to filter by, it could allow grouping only by the specified tag(s) and not the other tags present on each snapshot (I can imagine this to be very useful for others too)
  • allow disabling of grouping entirely, only filtering by provided tags e.g.

Afaik this is already possible, you can specify hostname with -H while running restic backup.

Ah, thank you @gurkan, I totally missed that one :see_no_evil:

I still believe it would be really helpful to be able to somehow make a command apply to all snapshots which have a given tag, no matter what other tags they may have and no matter what hostname they may have or what paths they refer to. E.g. to keep the last 5 snapshots which have a certain tag. I think the ability to disable the group-by feature would be very useful in this case. For sure, it can be enabled by default as a safety measure, but it would be great if one could specifically disable it in certain scenarios.