I have a strange one that quite possibly may be my mistake, but I’m uncertain.
I run forget
and backup
via Bash scripts which are triggered by systemd timers on Ubuntu 20.04. When I launch the backup process via systemctl
with restic producing normal text output, I see the output I expect in the journald logs:
...
Oct 20 09:28:09 host1 restic-backup.sh[982684]: [0:00] 100.00% 25 / 25 snapshots
Oct 20 09:28:10 host1 restic-backup.sh[982697]: using parent snapshot 37dc982c
Oct 20 09:28:11 host1 restic-backup.sh[982697]: Files: 0 new, 4 changed, 6523 unmodified
Oct 20 09:28:11 host1 restic-backup.sh[982697]: Dirs: 0 new, 5 changed, 2011 unmodified
Oct 20 09:28:11 host1 restic-backup.sh[982697]: Added to the repo: 173.197 KiB
Oct 20 09:28:11 host1 restic-backup.sh[982697]: processed 6527 files, 687.945 MiB in 0:01
Oct 20 09:28:11 host1 restic-backup.sh[982697]: snapshot c1fb982f saved
Oct 20 09:28:11 host1 restic-backup.sh[982683]: Finished restic backup
When I add the --json
flag and run the script by hand, I get the results I expect:
$ /usr/local/sbin/restic-backup.sh
Starting restic backup
using temporary cache in /tmp/restic-check-cache-966009993
repository 7477442f opened successfully, password is correct
created new cache in /tmp/restic-check-cache-966009993
create exclusive lock for repository
load indexes
check all packs
check snapshots, trees and blobs
no errors were found26 snapshots
[0:00] 100.00% 26 / 26 snapshots
{"message_type":"status","percent_done":0}
{"message_type":"status","percent_done":0.016352636412683117,"total_files":677,"files_done":17,"total_bytes":1214055,"bytes_done":19853}
{"message_type":"status","percent_done":0.08357231648752914,"total_files":1133,"files_done":174,"total_bytes":3422138,"bytes_done":285996}
{"message_type":"status","percent_done":0.0034864367706821065,"total_files":1853,"files_done":314,"total_bytes":133255249,"bytes_done":464586}
<snip>
{"message_type":"status","percent_done":0.9960340865076655,"total_files":6527,"files_done":6222,"total_bytes":721364953,"bytes_done":718504082}
{"message_type":"summary","files_new":0,"files_changed":1,"files_unmodified":6526,"dirs_new":0,"dirs_changed":2,"dirs_unmodified":2014,"data_blobs":1,"tree_blobs":3,"data_added":71017,"total_files_processed":6527,"total_bytes_processed":721364953,"total_duration":0.918486206,"snapshot_id":"bcc5c5b1"}
Finished restic backup
But when I add the --json
flag and let systemd launch the backup service, I get a slew of redundant progress messages in the logs:
$ systemctl show -p InvocationID --value restic-backup.service
9e69f66111b34811b787a93895150cfd
$ journalctl -o short-iso _SYSTEMD_INVOCATION_ID=9e69f66111b34811b787a93895150cfd |wc -l
37501
$ journalctl -o short-iso SYSLOG_IDENTIFIER=restic-backup.sh _SYSTEMD_INVOCATION_ID=9e69f66111b34811b787a93895150cfd |tail -n 10
2021-10-20T09:32:51-0700 Z97X-UD5H restic-backup.sh[983408]: {"message_type":"status","seconds_elapsed":1,"seconds_remaining":4,"percent_done":0.9999629840896144,"total_files":6527,"files_done":6477,"total_bytes":721365481,"bytes_done":721338779}
2021-10-20T09:32:51-0700 Z97X-UD5H restic-backup.sh[983408]: {"message_type":"status","seconds_elapsed":1,"seconds_remaining":4,"percent_done":0.9999629840896144,"total_files":6527,"files_done":6478,"total_bytes":721365481,"bytes_done":721338779}
2021-10-20T09:32:51-0700 Z97X-UD5H restic-backup.sh[983408]: {"message_type":"status","seconds_elapsed":1,"seconds_remaining":4,"percent_done":0.9999629840896144,"total_files":6527,"files_done":6478,"total_bytes":721365481,"bytes_done":721338779}
2021-10-20T09:32:51-0700 Z97X-UD5H restic-backup.sh[983408]: {"message_type":"status","seconds_elapsed":1,"seconds_remaining":4,"percent_done":0.9999629840896144,"total_files":6527,"files_done":6478,"total_bytes":721365481,"bytes_done":721338779}
2021-10-20T09:32:51-0700 Z97X-UD5H restic-backup.sh[983408]: {"message_type":"status","seconds_elapsed":1,"seconds_remaining":4,"percent_done":0.99996356077371,"total_files":6527,"files_done":6478,"total_bytes":721365481,"bytes_done":721339195}
2021-10-20T09:32:51-0700 Z97X-UD5H restic-backup.sh[983408]: {"message_type":"status","seconds_elapsed":1,"seconds_remaining":4,"percent_done":0.99996356077371,"total_files":6527,"files_done":6479,"total_bytes":721365481,"bytes_done":721339195}
2021-10-20T09:32:51-0700 Z97X-UD5H restic-backup.sh[983408]: {"message_type":"status","seconds_elapsed":1,"seconds_remaining":4,"percent_done":0.99996356077371,"total_files":6527,"files_done":6479,"total_bytes":721365481,"bytes_done":721339195}
2021-10-20T09:32:51-0700 Z97X-UD5H restic-backup.sh[983408]: {"message_type":"status","seconds_elapsed":1,"seconds_remaining":4,"percent_done":0.99996356077371,"total_files":6527,"files_done":6479,"total_bytes":721365481,"bytes_done":721339195}
2021-10-20T09:32:51-0700 Z97X-UD5H restic-backup.sh[983408]: {"message_type":"status","seconds_elapsed":1,"seconds_remaining":4,"percent_done":0.9999654294519812,"total_files":6527,"files_done":6479,"total_bytes":721365481,"bytes_done":721340543}
2021-10-20T09:32:51-0700 Z97X-UD5H restic-backup.sh[983408]: {"message_type":"status","seconds_elapsed":1,"seconds_remaining":4,"percent_done":0.9999654294519812,"total_files":6527,"files_done":6480,"total_bytes":721365481,"bytes_done":721340543}
$ journalctl -o short-iso _SYSTEMD_INVOCATION_ID=9e69f66111b34811b787a93895150cfd |grep "message_type"|grep "status"| wc -l
37475
And the summary information seems to be missing:
$ journalctl -o short-iso _SYSTEMD_INVOCATION_ID=9e69f66111b34811b787a93895150cfd |grep "summary"| wc -l
0
Any ideas on what is going on here?