Skip to content
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

log file doesn't contain backend/location details #28

Closed
sumnerboy12 opened this issue Jul 24, 2020 · 16 comments
Closed

log file doesn't contain backend/location details #28

sumnerboy12 opened this issue Jul 24, 2020 · 16 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@sumnerboy12
Copy link
Contributor

Example below. All the dynamic text which is displayed in the console is not visible so you don't know what backend and backup location were processed.

Is it possible to generate more flat-file-log-friendly output via a switch/flag?

Configuring Backends

Backing Up
Files:           0 new,     0 changed,     1 unmodified
Dirs:            0 new,     0 changed,     0 unmodified
Added to the repo: 0 B

processed 1 files, 0 B in 0:04
snapshot 8a093c2a saved

Finished! ð
@cupcakearmy
Copy link
Owner

Currently not but thats a good idea to have a flag. Will look into it the next days :)

@cupcakearmy cupcakearmy self-assigned this Jul 24, 2020
@cupcakearmy cupcakearmy added this to the 1.0 milestone Jul 24, 2020
@cupcakearmy cupcakearmy added the enhancement New feature or request label Jul 24, 2020
@stosem
Copy link

stosem commented Aug 6, 2020

Moreover, I can't detect failed tasks with Ansible.
autorestic always return 0 (success) as rc. Doesn't matter task was succeeded or not. And I can't catch Failed! on stdout:

Ansible stdout:

            "\u001b[4m\u001b[90m",
            "Configuring Backends\u001b[39m\u001b[24m",
            "\u001b[2K\u001b[1G\u001b[90m\u001b[4m",
            "Backing Up\u001b[24m\u001b[39m",
            "Files:           0 new,     1 changed,     0 unmodified",
            "Dirs:            0 new,     0 changed,     0 unmodified",
            "Added to the repo: 379 B",
            "",
            "processed 1 files, 2.500 KiB in 0:00",
            "snapshot bc536bdb saved null does not exist, skipping",
            "\u001b[2K\u001b[1GFiles:           0 new,     0 changed,     1 unmodified",
            "Dirs:            0 new,     0 changed,     0 unmodified",
            "Added to the repo: 0 B  ",
            "",
            "processed 1 files, 33 B in 0:00",
            "snapshot ed75da09 saved null does not exist, skipping",
            "\u001b[2K\u001b[1Gnull null",
            "\u001b[2K\u001b[1G\u001b[4m",
            "Finished!\u001b[24m 🎉"

While real output contains errors:

Configuring Backends
local-storage : Done ✓

Backing Up
test_docker ▶ local-storage : Backing up... ⏳Files:           0 new,     1 changed,     0 unmodified
Dirs:            0 new,     0 changed,     0 unmodified
Added to the repo: 379 B

processed 1 files, 2.500 KiB in 0:00
snapshot 2ce6f9b7 saved null does not exist, skipping
test_docker ▶ local-storage : Failed! (1s) null does not exist, skipping
test_home ▶ local-storage : Backing up... ⏳Files:           0 new,     0 changed,     1 unmodified
Dirs:            0 new,     0 changed,     0 unmodified
Added to the repo: 0 B

processed 1 files, 33 B in 0:00
snapshot 0ac6f2e1 saved null does not exist, skipping
test_home ▶ local-storage : Failed! (771ms) null does not exist, skipping
test_web ▶ local-storage : Backing up... ⏳null null
test_web ▶ local-storage : Failed! (5ms) null

@sumnerboy12
Copy link
Contributor Author

Would it be worth using a proper logging framework? Something like tslog perhaps? I have zero experience with TS so there may well be better options.

@cupcakearmy
Copy link
Owner

Hey, sry I forgot that was an issue. Probably I could rewrite the whole logging thing. It's quite ugly anyways.

@cupcakearmy
Copy link
Owner

cupcakearmy commented Nov 13, 2020

So. I've added a --ci (version 0.22+) global flag which disables the interactive part.
https://autorestic.vercel.app/cli/general#--ci

@stosem you are right should not return 1 on failed. I will do that next.
Feel free to reopen if it doesnt work for you 👍
And sry for the delay, you opened the issue almost half year ago 🙈

@cupcakearmy
Copy link
Owner

@stosem now returns with exit code 1 if a backup fails (v0.24)

@sumnerboy12
Copy link
Contributor Author

Thanks for this @cupcakearmy and please don't apologise for implementing a feature for free on an OSS project!! It is much appreciated.

Unfortunately it doesn't seem to work as expected, see below for how my log now looks;

Configuring Backends
^[[2K^[[1G^[[2K^[[1G^[[2K^[[1G^[[2K^[[1G^[[2K^[[1G^[[2K^[[1G^[[2K^[[1G^[[2K^[[1G^[[2K^[[1G
Backing Up
Files:           0 new,     0 changed, 22690 unmodified
Dirs:            0 new,     0 changed,   605 unmodified
Added to the repo: 0 B

processed 22690 files, 86.238 GiB in 0:05
snapshot 3ac11269 saved
^[[2K^[[1GFiles:           0 new,     0 changed, 22690 unmodified
Dirs:            0 new,     0 changed,   605 unmodified
Added to the repo: 0 B

So it is now printing the output to the log file (before it wasn't showing anything), but there seems to be some sort of encoding issue? Any ideas?

@cupcakearmy
Copy link
Owner

Yes. But un maintained projects always make me angry 😅
I'm sure that is the coloring. I'll comment it out if using --ci

@cupcakearmy
Copy link
Owner

Should be fixed in 0.25 CI is building, as soon it's done it will upload it and you can autorestic upgrade
Also of course pass the --ci flag to the cron. :)
Let me know 😊

@cupcakearmy cupcakearmy reopened this Nov 16, 2020
@sumnerboy12
Copy link
Contributor Author

sumnerboy12 commented Nov 22, 2020

Ok - the output is cleaned up but there is no mention of which backend/location is being processed. It just looks like the raw restic output I think. Any chance we can get more detailed logging of what is actually being processed? Very hard to tell in the log below what repo has been backed up etc. NOTE: this is running with --verbose.

Configuring Backends

Backing Up
Files:           0 new,     0 changed, 22690 unmodified
Dirs:            0 new,     0 changed,   605 unmodified
Added to the repo: 0 B

processed 22690 files, 86.238 GiB in 0:13
snapshot 28bfb301 saved
Files:           0 new,     0 changed, 22690 unmodified
Dirs:            0 new,     0 changed,   605 unmodified
Added to the repo: 0 B

processed 22690 files, 86.238 GiB in 0:02
snapshot a2c0c4b1 saved

Finished!  ^=^n^i

@cupcakearmy
Copy link
Owner

cupcakearmy commented Nov 30, 2020

I just checked. So this happens only with the --verbose flag. I'm going to look into it and see what happens there
Withouth the --verbose and only --ci flag there is a list of what happened

@sumnerboy12
Copy link
Contributor Author

I just tested without --verbose and didn't notice any difference. Here is the output when running from the command line;

root@pve:/home/ben# /usr/bin/autorestic --config /etc/.autorestic.yml --ci backup --location nas-personal

Configuring Backends
b2-personal : Configuring... ⏳
b2-personal : Done ✓
rest-personal : Configuring... ⏳
rest-personal : Done ✓

Backing Up
nas-personal ▶ b2-personal : Backing up... ⏳
nas-personal ▶ b2-personal : Done ✓ (8s)
               rest-personal : Backing up... ⏳
               rest-personal : Done ✓ (1s)

Finished! 🎉

And then exactly the same command, but piping to a log file results in;

root@pve:/home/ben# /usr/bin/autorestic --config /etc/.autorestic.yml --ci backup --location nas-personal >> test.log
root@pve:/home/ben# cat test.log

Configuring Backends

Backing Up

Finished! 🎉

@sumnerboy12
Copy link
Contributor Author

@cupcakearmy sorry to keep bugging you but is this still on your radar? it is not a major by any stretch but it would be great to have more useful logging for reconciliation and validation. no problem if you have higher priority issues to attend to of course!

@cupcakearmy
Copy link
Owner

It's on the list 🙂 I'm just burried in academic stuff right now unfortunately 😒 End of March there could be light xD

@sumnerboy12
Copy link
Contributor Author

sumnerboy12 commented Feb 9, 2021 via email

@cupcakearmy
Copy link
Owner

So.. it's been a long time. I've rewritten the whole thing in Go the past week and it's way more stable (and smaller).
@sumnerboy12 should be fixed. Feel free to repoen if that is not the case.
Note the (small) upgrade guide https://autorestic.vercel.app/upgrade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants