New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
backup: --quiet ignored with --json #3553
Comments
Nice avatar, looks smart! :) What is the use case of specifying these two options ( If this was "fixed", one could open an issue about |
Thanks. I try to rotate my avatar through a few random pieces of produce every year. Typically broccoli, rutabagas, turnips, etc. What can I say, I'm easily amused. :) Anyway, my use case is metrics collection for monitoring. Rather than email immediately on failures of things like backups, I prefer to collect metrics about what happened, monitor the metrics, and alert on them when necessary. Specifically, I like to take metrics, feed them into InfluxDB, and then alert on them using Grafana. For example, let's say I have a system which uses a systemd timer to take snapshots every hour and something causes the backups to start failing. If I have a simple failure handler that emails me, I run into a number of issues:
In fact, I don't necessarily care if a single backup fails; I'm more interested in multiple backups failing in a row. So, feeding metrics to a monitoring and alerting system ends up being more effective. I can collect a metric indicating success or failure and alert on that. In fact, that's pretty valuable. However, that's not the only thing I want to track. Given that I expect some degree of churn on a machine, I'd also like to make sure we actually see new files, changed files, etc. And that we processed > 0 files. In normal text mode, # restic backup --one-file-system --exclude-caches --files-from '/etc/restic/includes' --exclude-file '/etc/restic/excludes'
repository 7477442f opened successfully, password is correct
using parent snapshot 932770c1
Files: 0 new, 3 changed, 6524 unmodified
Dirs: 0 new, 4 changed, 2012 unmodified
Added to the repo: 603.625 KiB
processed 6527 files, 687.514 MiB in 0:00
snapshot d1124b4a saved However, I don't really enjoy parsing text output which can change. I'd rather get structured data that is easier to work with, such as the output from Currently, the help documentation for
That leads me to think that |
So put another way, the issue you are having is that when using I'm thinking that the text in the documentation is a bit off, because as you can tell from a regular non- Can you not simply filter out the status updates in the JSON output? I'm not sure why you're trying to configure this using options instead of filtering of the structured data to get only what you want. |
Independent of exactly what the behavior should be, I think it's still a bug that the combination of However, my assessment of what to change is incorrect. I forgot my rules of operator precedence for Golang. On further examination, I'm actually not sure why I'm seeing this behavior. With |
This comment has been minimized.
This comment has been minimized.
Ummm .... I'm pretty sure I have some very very good reasons why I don't want to do that... Lots and lots of really great reasons... So many I can't possibly list them all. :) backs away slowly In all seriousness, I feel like I had a reason ... but I can't remember what it was. Either it will come back to me or it wasn't very important. |
Hey, that's fine. Even if you don't know right now why you don't filter it out, you may very well have decided not to due to some reason earlier. How do you feed the output to InfluxDB, running the backup script using telegraf or something? In general one can use I meant earlier that currently |
Ah hah! I figured out why I ended up down this path in the first place! It's actually a weird interaction between systemd, journald, and restic json logging. I'll close this issue and post on the forum instead. Thanks! For posterity, a few comments.
I typically use Telegraf to feed data into InfluxDB. In this particular case, I use systemd timers to manage executing the backup processes, which makes Telegraf integration a bit tricky. At this point, I will likely push the data directly into InfluDB using either the
Ah! That makes a lot more sense. I've been focused on my non-interactive use case, so progress updates in JSON format aren't of value. However, I'm guessing that it's intended to support a web UI. |
Output of
restic version
restic 0.12.1 compiled with go1.16.6 on linux/amd64
How did you run restic exactly?
What backend/server/service did you use to store the repository?
restic rest-server
Expected behavior
restic backup --quiet --json
should not print progress information. This would align with the non-json behavior.Actual behavior
restic backup --quiet --json
prints progress status lines.Steps to reproduce the behavior
See above.
Do you have any idea what may have caused this?
Yes, the logic in the
calculateProgressInterval()
function looks to be incorrect.Do you have an idea how to solve the issue?
Yes, swap the order if the
if
statements incalculateProgressInterval()
inprogress.go
(PR to follow):Did restic help you today? Did it make you happy in any way?
The text was updated successfully, but these errors were encountered: