Configuration of logging in YAML config file #793
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'd like to do and why
Hi,
as of now, if one wants
borgmatic
's logs written to a file, command line arguments describing the desired logging settings need to be added toborgmatic
call.I would like to be able to just run
borgmatic create
and have the backup, together with log files, created.What I mean is to add the ability to configure logging in the YAML config file.
Additionally, I would like to have the log files be created with a particular umask (
0600
).Thank you for your support. :-)
--
Best regards,
Andrzej Telszewski
Other notes / implementation ideas
No response
Thanks for filing this! The main reason borgmatic's log configuration can only be done on the command-line today is that logging begins before the configuration files are even loaded!
It's possible though that if logging options were added to borgmatic configuration, then any log messages could be buffered/delayed until configuration files are loaded and logging options are parsed. However that still wouldn't help with logging any errors that occur as part of loading configuration files. Maybe that's good enough?
There would also be the wrinkle of what to do if multiple configuration files are loaded and they have different logging configurations in each. Maybe the solution there is just to warn or error. Or maybe even different logging options per configuration file could actually be supported.
The umask features makes sense to me.
Hi,
That sounds correct.
That's a similar situation that we have with daemonizing programs.
If log file cannot be created (i.e. config parsed), then there will normally be no sign of failure in daemon start-up.
The solution I see here is that, if
borgmatic
is unable to parse config files, it should print the message to stderr.When run by hand, the user will see the message directly.
When run in an automated way, it will be the supervisor (e.g.
cron
) that should log the error message.If everything with parsing the config files went correct, then the buffered messages would be logged to log files.
If it didn't, the messages would be printed to stderr.
If there is different configuration for the same thing, I would just error out.
Here we come to the same thing mentioned above.
If I'm not mistaken,
borgmatic
is repo-centric (or maybe rather label-centric?)I mean, it will parse and merge config files, to ultimately find out what repose are there and will run actions for each of them.
Would it maybe make more sense to have per-repo logging configuration, and not per-config file?
And then, if across multiple config files the logging config for particular repo is different, then just error out?
Also, I would like to have a global config, if one wants to log everything (all repos) to a single log file.
--
Best regards,
Andrzej Telszewski
borgmatic is actually configuration-file centric. A top-level configuration file can include one or more repositories, and configuration files are not normally merged unless an explicit include is performed. So for instance a setup might look like this:
Anyway, yes, we could just error out if there is conflicting logging config. And/or, as you suggest, have a global configuration.
Hi,
thank you for the explanation. :-)
On the topic of the log file name, I find it would be useful to be able to name the log file after the archive name.
The result I would like to achieve is to have a log of a particular
create
run.--
Best regards,
Andrzej Telszewski
Related: #303.