zalando / spilo

Highly available elephant herd: HA PostgreSQL cluster using Docker
Apache License 2.0
1.51k stars 371 forks source link

Support different log rotation plan #954

Open annielzy opened 7 months ago

annielzy commented 7 months ago

Issue Summary:

Currently, Spilo assumes that the Postgres log is rotated based on weekdays, which is not an ideal logging plan for actual production use. However, if we try to modify the log rotation setup, this assumption will cause problems in the backup and restore process, as it will not reset all possible recovery targets and retry without the correct log file: https://github.com/zalando/spilo/blob/d554db0d02806342123fc6a143fd84494c53ca9b/postgres-appliance/bootstrap/maybe_pg_upgrade.py#L58

Proposal:

Although there are several places in Spilo that assume the default log rotation plan based on weekdays, the only place that is blocking overrides is: https://github.com/zalando/spilo/blob/d554db0d02806342123fc6a143fd84494c53ca9b/postgres-appliance/bootstrap/maybe_pg_upgrade.py#L17 This can be easily fixed by modifying the method of finding the current Postgres log file.

hughcapet commented 7 months ago

Well, as for us it is the „ideal logging plan“ happily used in production environment for many years now (given we have daily logs shipment to s3), we are not planning to invest time into this improvement. But you can of course implement it yourself and submit a pr (with the reasoning provided).