Environement variable that indicates borgmatic's logfile #413

Closed
opened 2021-04-30 14:20:32 +00:00 by Matows · 3 comments

What I'm trying to do and why

I'd like a way to get logs of borg and/or borgmatic output.

I'm using pushover to notify me about backup starting/ending/error but I'd like to join the log when starting/ending.

Other notes / implementation ideas

It would be great to have a environment variable reachable from after_backup, after_everything... that indicate the log file borgmatic is writting to (--log-file ?).

So it could be used like this :

...
hooks:
    after_backup:
        - mail -s "Backup completed!" admin@example.com < "${BORGMATIC_LOGFILE}"
    

Environment

borgmatic version: 1.5.13

borgmatic installation method: pip (debian package outdated)

Borg version: 1.1.9

Python version: 3.7.3

operating system and version: Debian GNU/Linux 10 (buster)

#### What I'm trying to do and why I'd like a way to get logs of borg and/or borgmatic output. I'm using [pushover](https://pushover.net) to notify me about backup starting/ending/error but I'd like to join the log when starting/ending. #### Other notes / implementation ideas It would be great to have a environment variable reachable from `after_backup`, `after_everything`... that indicate the log file borgmatic is writting to (--log-file ?). So it could be used like this : ``` ... hooks: after_backup: - mail -s "Backup completed!" admin@example.com < "${BORGMATIC_LOGFILE}" ``` #### Environment **borgmatic version:** 1.5.13 **borgmatic installation method:** pip (debian package outdated) **Borg version:** 1.1.9 **Python version:** 3.7.3 **operating system and version:** Debian GNU/Linux 10 (buster)
Owner

I apologize for the lengthy delay in responding to this. This seems reasonable to me—as long it's clear it'll only work if borgmatic is actually logging to a file via --log-file!

I apologize for the lengthy delay in responding to this. This seems reasonable to me—as long it's clear it'll only work if borgmatic is actually logging to a file via `--log-file`!
witten added the
good first issue
label 2023-03-27 19:04:03 +00:00
Owner

Implemented by @diivi in https://github.com/borgmatic-collective/borgmatic/pull/68. The documentation will be here shortly: https://torsion.org/borgmatic/docs/how-to/add-preparation-and-cleanup-steps-to-backups/#variable-interpolation

The summary though is that there's a new log_file hook variable you can use in your command hooks. E.g.:

...
hooks:
    after_backup:
        - mail -s "Backup completed!" admin@example.com < "${log_file}"
Implemented by @diivi in https://github.com/borgmatic-collective/borgmatic/pull/68. The documentation will be here shortly: https://torsion.org/borgmatic/docs/how-to/add-preparation-and-cleanup-steps-to-backups/#variable-interpolation The summary though is that there's a new `log_file` hook variable you can use in your command hooks. E.g.: ```yaml ... hooks: after_backup: - mail -s "Backup completed!" admin@example.com < "${log_file}" ```
Owner

This has been released in borgmatic 1.7.12! Thanks for the suggestion.

This has been released in borgmatic 1.7.12! Thanks for the suggestion.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#413
No description provided.