zalando / postgres-operator

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

PG_LOG removal - best practices? #1579

Open mgorsk1 opened 3 years ago

mgorsk1 commented 3 years ago

Please, answer some short questions which should help us to understand your problem / question better?

We are deploying postgresql clusters on production using zalando postgres-operator. What we are curious about is what is the recommended way of removing older logs from pg_log directory? In our case we are mounting 32GB PVC and it gets filled within 2-3 days up to 100% which makes the db unusable. I didn't find anywhere in the settings a way to remove older logs, just to truncate them which means it would still grow continously.

FxKu commented 3 years ago

Logs are recycled weekly, hence the numbering of log files from 1 (monday) to 7 (sunday). By default, queries running longer than 500ms will get logged, to better analyze slow queries. Not sure, if that's the reason in your case (could also be logged connections).

You can increase the corresponding config option log_min_duration_statement e.g. by defining it in the manifest (parameters section under postgresql) or change in the pod with patronictl edit-config.