Snapshot logging

Hi,

When performing a snapshot with a verbose flag we can get an interesting feedback about what have been done, such as

open repository
lock repository
load index files
using parent snapshot d63673ab
start scan on [/]
start backup on [/]
scan finished in 385.567s: 1576834 files, 403.091 GiB

Files:         212 new,   550 changed, 1576166 unmodified
Dirs:            0 new,     0 changed,     0 unmodified
Data Blobs:    537 new
Tree Blobs:      1 new
Added to the repo: 142.202 MiB

processed 1576928 files, 403.091 GiB in 14:49
snapshot 32933b5f saved

Adding an other verbose flag also shows all files that have been uploaded to the new snapshot.

Unfortunately those information are lost once the snapshot is finished.

The stats command can retrieve some information but not as complete as the verbose flag, and may take ages to get:

scanning...
Stats for 32933b5f in restore-size mode:
  Total File Count:   1950087
        Total Size:   403.065 GiB

What about having a fast log information by storing the result of the verbose flag within the repository. I guess one of the easiest way would be to create a /logs at the root of the repository and store file there or as a sidecar file in the /snapshots directory.

Then having a command such as log <SNAPTSHOTID> would quickly retrieve the wanted information. This should be compatible with the current repository layout. If old snapshot exists without any log information, a simple warning should be displayed.

What about such a feature?

Thanks in advance.

Much of this same information can be obtained by using restic diff.

Yes you’re right.

Pros: can compare arbitrary snapshots
Cons: takes ages.

However retrieving a diff can take time compared to cat an object.

Maybe this can be an axis of improvement. Especially with large repos. Because at the end of the day you mainly want to see the differences between a snapshot and the previous one.

Hello man…

I used to this command to get a logs easier, maybe its works for you too.

restic backup “file to backup” --tag “your tag” 2>> ~/restic.err >> ~/restic.log

Example from the “restic.err”.

root@srv-backups-01:~# cat restic.err
/root/Vol-FILESERVER01-OPERACOES-LOCAL0016 does not exist, skipping
Fatal: all target directories/files do not exist
Save(<data/83abad64d8>) returned error, retrying after 298.433393ms: client.PutObject: Put h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/83/83abad64d8fe9a6ac1990dd16e7fbc40ccdea15ed318971d6ca94d3765ad6e78: Connection closed by foreign host h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/83/83abad64d8fe9a6ac1990dd16e7fbc40ccdea15ed318971d6ca94d3765ad6e78. Retry again.
Save(<data/6722496e83>) returned error, retrying after 571.074563ms: client.PutObject: Put h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/67/6722496e8311d89769d05b71274bc307d49754d14e512f3f47a68e1570e9d70b: Connection closed by foreign host h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/67/6722496e8311d89769d05b71274bc307d49754d14e512f3f47a68e1570e9d70b. Retry again.
Save(<data/42e541999c>) returned error, retrying after 327.32034ms: client.PutObject: Put h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/42/42e541999c7a2cd1d49af949e7ebd8ebd0b672f9942166aad4a9ff0eedbc34b3: Connection closed by foreign host h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/42/42e541999c7a2cd1d49af949e7ebd8ebd0b672f9942166aad4a9ff0eedbc34b3. Retry again.
Save(<data/e117d22c41>) returned error, retrying after 553.237319ms: client.PutObject: Put h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/e1/e117d22c410db3476bf34bc5ecb82455d8440eb91b5d4b5eb088ed1ccd20f0bc: Connection closed by foreign host h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/e1/e117d22c410db3476bf34bc5ecb82455d8440eb91b5d4b5eb088ed1ccd20f0bc. Retry again.
Save(<data/2e30fbf200>) returned error, retrying after 389.356568ms: client.PutObject: Put h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/2e/2e30fbf2007c1e8667e9ca1e12e828c1ec95f8b2d6c056b4aa48ba76e5a69092: Connection closed by foreign host h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/2e/2e30fbf2007c1e8667e9ca1e12e828c1ec95f8b2d6c056b4aa48ba76e5a69092. Retry again.
Save(<data/62843683b1>) returned error, retrying after 299.375833ms: client.PutObject: Put h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/62/62843683b115eac7d6c700074a00e28c25ae1720e967928ed80af6112f18d0f8: Connection closed by foreign host h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/62/62843683b115eac7d6c700074a00e28c25ae1720e967928ed80af6112f18d0f8. Retry again.
Save(<data/963426a2df>) returned error, retrying after 413.019796ms: client.PutObject: Put h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/96/963426a2dffa732f347c04f049859d958fc6b9c30a78f55a397ee260f77a8236: Connection closed by foreign host h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/96/963426a2dffa732f347c04f049859d958fc6b9c30a78f55a397ee260f77a8236. Retry again.
Save(<data/265e1c6536>) returned error, retrying after 414.925925ms: client.PutObject: Put h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/26/265e1c6536c64761f03d567f54dda99016a8c4a32b45d99612cb699191908cd2: Connection closed by foreign host h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/26/265e1c6536c64761f03d567f54dda99016a8c4a32b45d99612cb699191908cd2. Retry again.
Save(<data/dc214a6344>) returned error, retrying after 680.011973ms: client.PutObject: Put h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/dc/dc214a63444107bd7d865e3750615ac2fe6219204a10719e580e8b066e8025e6: Connection closed by foreign host h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/dc/dc214a63444107bd7d865e3750615ac2fe6219204a10719e580e8b066e8025e6. Retry again.
Save(<data/518b9f56ba>) returned error, retrying after 374.400763ms: client.PutObject: Put h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/51/518b9f56baf5e8178654ac837112c0b0bf281fd629cb1167db7734c370731866: Connection closed by foreign host h-ttps://hsprevent-backup-bacula1.s3-sa-east-1.amazonaws.com/data/51/518b9f56baf5e8178654ac837112c0b0bf281fd629cb1167db7734c370731866. Retry again.

Example from the “restic.log”.
root@srv-backups-01:~# cat restic.log
scan [/mnt/backup/Vol-FILESERVER01-OPERACOES-LOCAL0016]
[0:00] 0 directories, 1 files, 450.259 GiB
scanned 0 directories, 1 files in 0:00
[10:43:16] 100.00% 450.259 GiB / 450.259 GiB 1 / 1 items 0 errors ETA 0:00

duration: 10:43:16
snapshot fe24cfc6 saved
scan [/mnt/backup/Vol-APP-LOCAL0024]
[0:00] 0 directories, 1 files, 957.109 MiB
scanned 0 directories, 1 files in 0:00
[1:26] 100.00% 957.109 MiB / 957.109 MiB 1 / 1 items 0 errors ETA 0:00

duration: 1:26
snapshot b4a12f97 saved
scan [/mnt/backup/Vol-APP-LOCAL0027]
[0:00] 0 directories, 1 files, 958.746 MiB
scanned 0 directories, 1 files in 0:00
[1:24] 100.00% 958.746 MiB / 958.746 MiB 1 / 1 items 0 errors ETA 0:00

duration: 1:24
snapshot d6c0f5cb saved
using parent snapshot d6c0f5cb
scan [/mnt/backup/Vol-APP-LOCAL0027]
[0:00] 0 directories, 1 files, 1.873 GiB
scanned 0 directories, 1 files in 0:00
[1:30] 100.00% 1.873 GiB / 1.873 GiB 1 / 1 items 0 errors ETA 0:00

duration: 1:30
snapshot c32dc429 saved

Hello,

This can be used for debugging purposes. I am not sur this a long term solution since the logs are not in the repo itself.

The diff command is a nice way to get all info but you have to be a bit patient because here size matters :smiley: .