postgres-operator icon indicating copy to clipboard operation
postgres-operator copied to clipboard

How can I change the Patroni log level?

Open boonen opened this issue 5 years ago • 8 comments

For my production postgres clusters I'd like to limit log messages to a reasonable amount. Therefore I want to get rid off all the Patroni log messages that are logged - about every 10 seconds - at the INFO level, e.g.:

11/9/2020 5:27:22 PM 2020-11-09 16:27:22,345 INFO: Lock owner: cluster-name-0; I am cluster-name-0
11/9/2020 5:27:22 PM 2020-11-09 16:27:22,401 INFO: no action.  i am the leader with the lock

I found in the Patroni documentation that I can set the environment variable PATRONI_LOG_LEVEL, but I don't know how I can achieve this when Patroni is managed with the Postgres Operator (I use version v1.5.0). I tried setting it in the ConfigMap that I also use to configure WAL backups, but that hadn't any effect. Can anybody point me in the right direction?

Besides these Patroni messages I also see the following message about every 30 seconds:

2020-11-09 16:27:21.335 46 LOG {ticks: 0, maint: 0, retry: 0}

I don't know where it is coming from and how to suppress these message. Again, any help is appreciated.

boonen avatar Nov 09 '20 16:11 boonen

PATRONI_LOG_LEVEL check the docs, we allow I think to inject custom environment variables into the statefulset.

@CyberDem0n may know the answer to part two.

Jan-M avatar Nov 13 '20 21:11 Jan-M

Just raised https://github.com/zalando/patroni/issues/1800 which is closely related, I think.

stephan2012 avatar Dec 14 '20 17:12 stephan2012

@Jan-M @CyberDem0n I have tried your suggestion to pass the environment variable PATRONI_LOG_LEVEL to the StatefulSet, but unfortunately this has no result. It seems that Spilo does not configure Patroni using the supplied environment variable. Do you have any hints on how to get this working?

I'm using the latest build of Spilo (from master) which runs Patroni 2.0.0. Output of env | grep PATRONI in the Spilo Pod returns the following information:

PATRONI_LOG_LEVEL=WARNING
PATRONIVERSION=2.0.0

boonen avatar Jan 19 '21 14:01 boonen

Did you manage to set the patroni env vars? I also tried the variable PATRONI_LOG_FORMAT which is completely ignored.

@boonen

DrissiReda avatar Feb 17 '22 09:02 DrissiReda

A little late, but yes, most environment variables are ignored so that secret information is not leaked. Spilo does this, see the issue I raised here https://github.com/zalando/spilo/issues/718.

mhaley-tignis avatar Apr 18 '22 19:04 mhaley-tignis

`patroni 2.1.7

patroni.yml scope: patroni_cluster name: hostname

log: level: WARNING `

edserrano419 avatar Jan 27 '23 22:01 edserrano419

any new to change log level?

holooloo avatar Nov 27 '23 17:11 holooloo

Not have ability to operate such basic things for troubleshooting is very critical

dragoangel avatar Aug 19 '24 08:08 dragoangel