Include restic logs
palto42 opened this issue · 2 comments
I tried runrestic
and it seems to work in principle, but I don't get any log messages from restic
itself, even if I specify log level "debug".
Is this intended behaviour or an issue with my installation?
I installed runrestic
in Python 3.9 virtual environment and got no errors or warnings, for "backup" I only get the "spawning" message and no further putput.
Example output for "stats" command, which at least provides the result output:
$ sudo /opt/runrestic/bin/runrestic stats -l debug
Parsing configuration file: /etc/runrestic/user_backup.toml
[Environment] RESTIC_PASSWORD=**********
Spawning "['restic', '-r', 'rclone:qnap:my_pc/restic/users', 'stats', '-q', '--json']"
{
"errors": 0,
"stats": {
"rclone:qnap:my_pc/restic/users": {
"total_file_count": 3636345,
"total_size_bytes": 52699188029,
"duration_seconds": 156.62893509864807,
"rc": 0
}
},
"last_run": 1636301210.36535,
"total_duration_seconds": 156.64174032211304
}
I found some time now to look deeper into the code and understood that the output form restic
and the pre/post hooks is mostly ignored.
Since I would like to have logs from restic
in my backup jobs, I forked this repository and developed a solution to add the output from restic
into the runrestic
logs. You can find the modified code in the branch restic_logs with a short explanation in the README.
Example logs at "info" level:
Mär 13 15:31:44 cubitus systemd[1]: Starting runrestic backup...
Mär 13 15:31:50 cubitus runrestic[42715]: restic: using parent snapshot 724e154c
Mär 13 15:31:50 cubitus runrestic[42715]: restic: [0:00] 0 files 0 B, total 0 files 0 B, 0 errors
Mär 13 15:32:33 cubitus runrestic[42715]: restic: Files: 564 new, 290 changed, 123565 unmodified
Mär 13 15:32:33 cubitus runrestic[42715]: restic: Dirs: 305 new, 595 changed, 25554 unmodified
Mär 13 15:32:33 cubitus runrestic[42715]: restic: Added to the repo: 68.563 MiB
Mär 13 15:32:33 cubitus runrestic[42715]: restic: processed 124419 files, 20.709 GiB in 0:43
Mär 13 15:32:33 cubitus runrestic[42715]: restic: snapshot 799e180a saved
Mär 13 15:32:33 cubitus runrestic[42841]: echo: Pre-hook test message
Mär 13 15:32:33 cubitus runrestic[42846]: restic: /boot/*.txt does not exist, skipping
Mär 13 15:32:35 cubitus runrestic[42846]: restic: using parent snapshot c1a41675
Mär 13 15:32:35 cubitus runrestic[42846]: restic: [0:00] 0 files 0 B, total 1 files 0 B, 0 errors
Mär 13 15:32:36 cubitus runrestic[42846]: restic: Files: 2 new, 14 changed, 956 unmodified
Mär 13 15:32:36 cubitus runrestic[42846]: restic: Dirs: 0 new, 8 changed, 195 unmodified
Mär 13 15:32:36 cubitus runrestic[42846]: restic: Added to the repo: 87.004 KiB
Mär 13 15:32:36 cubitus runrestic[42846]: restic: processed 972 files, 14.650 MiB in 0:01
Mär 13 15:32:36 cubitus runrestic[42846]: restic: snapshot 7c7ed896 saved
Mär 13 15:32:36 cubitus runrestic[42851]: echo: Post-hook test message
Mär 13 15:32:37 cubitus runrestic[42895]: restic: using parent snapshot f9546756
Mär 13 15:32:37 cubitus runrestic[42895]: restic: [0:00] 0 files, 0 B, 0 errors
Mär 13 15:32:38 cubitus runrestic[42895]: restic: Files: 0 new, 0 changed, 1888 unmodified
Mär 13 15:32:38 cubitus runrestic[42895]: restic: Dirs: 0 new, 0 changed, 103 unmodified
Mär 13 15:32:38 cubitus runrestic[42895]: restic: Added to the repo: 0 B
Mär 13 15:32:38 cubitus runrestic[42895]: restic: processed 1888 files, 11.342 GiB in 0:00
Mär 13 15:32:38 cubitus runrestic[42895]: restic: snapshot 82c08ade saved
Mär 13 15:32:38 cubitus systemd[1]: runrestic.service: Succeeded.
Mär 13 15:32:38 cubitus systemd[1]: Finished runrestic backup.
Mär 13 15:32:38 cubitus systemd[1]: runrestic.service: Consumed 1min 30.063s CPU time.
I your'e interested to add such function to your repo, I can raise a PR.