## 3.2.0
### Added - File logging to `/var/log/ha-backup.log`. Each line has a full date and time, and the file is appended to on every run. - New `LOG_FILE` setting in `home_assistant_backup.conf`. Set it to a custom path, or to `"none"` to disable file logging. - `ssh`/`scp` error output is also written to the log file. - Deletions of old local backups are now logged. ### Changed - All console messages now go through the same logger, so remote cleanup, notification failures and config validation errors appear in the log too. - If the log file can't be opened (for example, no write permission to `/var/log`), a warning is printed and the backup continues without file logging. - The terminal progress bar stays on the console only and is not written to the log.
This commit is contained in:
1 parent
5c05a27ae2
commit
6b9bd80fa8
3 files changed
+135
-30
No files matched your search
+33
-1
@@ -15,8 +15,40 @@ Cross-compile examples:
|
||||
GOOS=linux GOARCH=amd64 go build -o ha-backup-linux-amd64 .
|
||||
GOOS=linux GOARCH=arm64 go build -o ha-backup-linux-arm64 . # Raspberry Pi / ARM NAS
|
||||
|
||||
|
||||
## Logging
|
||||
|
||||
ha-backup writes a log to `/var/log/ha-backup.log` by default. Each line is timestamped, and the file is appended to on every run. The same output is still printed to the console.
|
||||
|
||||
### Create the log file
|
||||
|
||||
Writing to `/var/log` requires elevated permissions, so create the file once and give ownership to the user that runs the backup. Replace `backupuser` with that user (use `root` if you run it as root):
|
||||
|
||||
|
||||
If you'd rather do it in steps:
|
||||
|
||||
```
|
||||
sudo touch /var/log/ha-backup.log
|
||||
sudo chown backupuser:backupuser /var/log/ha-backup.log
|
||||
sudo chmod 640 /var/log/ha-backup.log
|
||||
```
|
||||
|
||||
If the log file can't be opened, ha-backup prints a warning and continues the backup without file logging.
|
||||
|
||||
### Change or disable the log location
|
||||
|
||||
Set `LOG_FILE` in `home_assistant_backup.conf`:
|
||||
|
||||
```bash
|
||||
LOG_FILE="/var/log/ha-backup.log" # default
|
||||
LOG_FILE="/home/backupuser/ha-backup.log" # custom path
|
||||
LOG_FILE="none" # disable file logging
|
||||
```
|
||||
|
||||
|
||||
## Run
|
||||
./ha-backup # looks for home_assistant_backup.conf next to the binary, then in cwd
|
||||
./ha-backup # looks for home_assistant_backup.conf next to the binary, then in cwd
|
||||
./ha-backup -config /path/to.conf
|
||||
|
||||
|
||||
Requires `ssh` and `scp` on the machine running it. `jq` and `yq` are no longer needed.
|
||||
Reference in new issue
Block a user