Backup level --verbose 1.5

Just throwing out here as a suggestion —

Currently backup ---verbose doesn’t list what files are added.
However backup --verbose --verbose lists all files even those not modified.

When logging - former not so helpful if I want to know when file was added. Latter not so helpful is it includes full list of files which is cumbersome.

Is there any way to get logging level to list out only newly added /modified files? (A verbosity level of 1.5 so to speak!)

Hii

After the backup completes you can do a diff

Restic diff snapshotid snapshotid

If I recall correctly there is a “latest” that can be used as a snapshot ID; is there something with 2nd-latest ? I ask because keeping track of the IDs would be introduce state into the backup job handling which is a complication.

I guess no
But if you are on a Linux box I guess you can try some tail and awk to get the 2nd latest snapshot id and use it to diff in a script.

Yeh a bit annoying to set up as would need additional “list” run and lot of munging to extract out the last two IDs (and then another diff run to add to the logs)

I am comparing against borg and it’s verbose output show modified/added files only. Its really helpful because I can see from the backup logs which smallest (no extra lines; nothing new backed up) and larger (more lines so listing out files) and zoom on what was done in each backup fairly easily.

I think this should be considered as no file-level output and all files listed seems to be two extremes.

The following added to your backup script will give you the diff of the last two snapshots. There is another, simpler way of doing it, but I could never get it to work.

PREV=$(/usr/bin/restic snapshots --compact | tail -4 | head -1 | awk ‘{print $1}’)
LAST=$(/usr/bin/restic snapshots --compact | tail -3 | head -1 | awk ‘{print $1}’)
/usr/bin/restic diff “$PREV” “$LAST”

If you want a Windows Powershell bunch of commands to do a diff of the last two snapshots I’ve created a recipe. Modify as needed:

For completeness, here’s a couple of bash one-liners. First with head, tail and awk:

restic diff $(restic snapshots --compact | tail -4 | head -2 | awk ‘BEGIN{ORS=" "}; {print $1}’)

Then, if json’s more your thing (from here, but adding a --json flag which I suspect was accidentally missing from the original post):

restic diff $(restic snapshots --compact --json | jq -r ‘.[-2:].id’)

cut is more succinct (and IMO more readable) than awk in this case :slight_smile:

restic diff $(restic snapshots | tail -n4 | head -n2 | cut -d' ' -f1)