Closed manute closed 2 years ago
Hi,
That's weird. What version are you using? In the current one, --log-level-console=error
is passed to pgbackrest info so warnings shouldn't be returned by pgBackRest.
Could you try adding --debug
to see exactly what pgbackrest info
command is used by check_pgbackrest?
Yeah, the versions are :
> check_pgbackrest --version
check_pgbackrest version 2.2, Perl 5.30.0
> pgbackrest version
pgBackRest 2.38
And the issue is when the pgbackrest.conf
contains an invalid option, so it seems that the WARNING appears even if the --log-level-console=error
is passed:
> check_pgbackrest -c /home/appuser/bad.conf -S an -s retention -Ojson --debug
DEBUG: pgBackRest info command was : 'pgbackrest info --stanza=an --output=json --log-level-console=error --config=/home/appuser/bad.conf'
malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "WARN: configuration ...") at /usr/bin/check_pgbackrest line 540.
Executing the actual pgbackrest info
cmd from the above msg:
> pgbackrest info --stanza=an --output=json --log-level-console=error --config=/home/appuser/bad.conf
WARN: configuration file contains invalid option 'repo1-s3-key-role'
[{"archive":[{"database":{"id":1,"repo-key":1},"id":"..... rest of the json"}]
Thanks!
That behavior comes from pgBackRest itself to make sure config file warnings will be output.
We removed the "WARN" filtering previously because of various reported issues. So I'd prefer not to bring it back.
I kinda have mixed feelings about this "issue". I believe the best answer would be: please, fix your pgBackRest configuration. In the sense that ignoring configuration errors might lead to point to inaccurate data without you knowing...
That being said, I agree the error message should be improved. Would it make sense to have this kind of output ?
DEBUG: pgBackRest info command was : 'pgbackrest info --stanza=mycluster --output=json --log-level-console=error'
pgBackRest output was not valid JSON.
HINT: does your configuration file contain invalid option?
Kind Regards
Oh yeah, that would be awesome! Because the main issue is that the check_pgbackrest
cmd was not showing the real error so that will fix it.
Thanks!
Hey @pgstef ,
Thank you for creating this project! It 's very useful!
One thing I noticed is that if the
pgbackrest
info is throwing a WARNING before the results the decode json fails (I think is the line 540), ie: