If i have two snapshots with the following tags:
"app=dbbackup", "db=somedb", "master=prod"
"app=dbbackup", "db=someotherdb", "master=dev"
restic snapshots --json --tag app=dbbackup --tag db=somedb
returns them both. The only way to return only the snapshot with the “db=somedb” tag is to remove
--tag app=dbbackup. It seems that the tags are "or"ed together, so adding more tags casts a wider net. I would have expected it to make the search more specific. I didn’t see anything in the docs that specifically stated how it works. Are the tags “anded” or “ored”?
Welcome to forums
Looks like they’re “ored”. But do you have a special reason to rely only on restic’s
snapshots command for excluding a tag? Asking since you can at least exclude some tags on
forget command via
@cmusser The snapshots command returns all snapshots which match all tags in any of the passed taglists. Your command
restic snapshots --json --tag app=dbbackup --tag db=somedb passes two taglists
db=somedb to restic, so the result returns any snapshot with tags
app=dbbackup OR db=somedb. To only return snapshots with both tags specify them as one taglist:
Ah, ok, that makes sense. It’s flexible then. Thanks for clarifying!