zalando / postgres-operator

Postgres operator creates and manages PostgreSQL clusters running in Kubernetes
https://postgres-operator.readthedocs.io/
MIT License
4.25k stars 969 forks source link

How can I change the Patroni log level? #1203

Open boonen opened 3 years ago

boonen commented 3 years ago

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.

Jan-M commented 3 years ago

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.

stephan2012 commented 3 years ago

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

boonen commented 3 years ago

@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
DrissiReda commented 2 years ago

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

@boonen

mhaley-tignis commented 2 years ago

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.

edserrano419 commented 1 year ago

`patroni 2.1.7

patroni.yml scope: patroni_cluster name: hostname

log: level: WARNING `

holooloo commented 9 months ago

any new to change log level?

dragoangel commented 4 weeks ago

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