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

How can I change the Patroni log level? #1203

Open
boonen opened this issue Nov 9, 2020 · 8 comments
Open

How can I change the Patroni log level? #1203

boonen opened this issue Nov 9, 2020 · 8 comments
Labels
patroni Issue more related to Patroni question

Comments

@boonen
Copy link

boonen commented Nov 9, 2020

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
Copy link
Member

Jan-M commented Nov 13, 2020

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 Jan-M added the question label Nov 13, 2020
@stephan2012
Copy link
Contributor

Just raised patroni/patroni#1800 which is closely related, I think.

@FxKu FxKu added the patroni Issue more related to Patroni label Dec 15, 2020
@boonen
Copy link
Author

boonen commented Jan 19, 2021

@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
Copy link

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

@boonen

@mhaley-tignis
Copy link

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 zalando/spilo#718.

mhaley-tignis added a commit to mhaley-tignis/postgres-operator that referenced this issue Apr 18, 2022
* Update postgresql CRD to include patroni log configuration
* Have operator include log config (if available) in the `SPILO_CONFIGURATION`
environment variable.
@edserrano419
Copy link

edserrano419 commented Jan 27, 2023

`patroni 2.1.7

patroni.yml
scope: patroni_cluster
name: hostname

log:
level: WARNING
`

@holooloo
Copy link

any new to change log level?

@dragoangel
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patroni Issue more related to Patroni question
Projects
None yet
Development

No branches or pull requests

9 participants