Repository navigation
feat: collect logs with the operator's log collector, on for new instances - #91
Merged
Merged
Conversation
- pg-operator Helm dependency 3.0.0 -> 3.1.0 - Go module: the operator moved to github.com/percona/percona-postgresql-operator/v3 in 3.1.0, so imports switch from the v2 pseudo-version to v3 v3.1.0. The provider sets crVersion from it, so instances are moved to crVersion 3.1.0. - Version catalog: add the images certified with 3.1.0 (PostgreSQL 14.24-1, 15.19-1, 16.15-1, 17.11.1-1, 18.6.1-1, pgBouncer 1.25.2-6, pgBackRest 2.59.0-1) and make them the defaults; every bundle uses pgBouncer 1.25.2-6. - PG_OPERATOR_VERSION 3.1.0 for CRDs and tests; upgrade tests start from 3.0.0. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Sergey Pronin <sp@solanica.io>
…ances Operator 3.1.0's log collector adds a Fluent Bit "logs" sidecar that streams PostgreSQL and pgBackRest logs to stdout as JSON, and a "logrotate" sidecar that caps the log files on the data volume. Without it, PostgreSQL logs (including pgaudit records) only exist as files on the data volume. engine.parameters.logCollector.enabled controls it. Unset, the provider sends the logcollector block without enabled, so the operator turns it on for new clusters and keeps existing clusters as they are: upgrading the provider doesn't restart existing instances. The image comes from a new fluentbit catalog entry; the sidecars get default requests and limits. The UI toggle defaults to on when creating and to the spec's value when editing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Sergey Pronin <sp@solanica.io>
Resolve conflicts with pgHBA from main: keep both engine parameters (pgHBA, then logCollector) in the types, topology, Sync, Validate, tests and README, and regenerate the provider spec. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
oksana-grishchenko
approved these changes
Nov 19, 2026
# Conflicts: # charts/provider-percona-postgresql/generated/provider-spec.yaml # go.mod # go.sum # internal/provider/backup_mirror.go # internal/provider/backup_mirror_test.go # internal/provider/provider.go
Signed-off-by: Oksana Grishchenko <oksana.grishchenko@percona.com>
# Conflicts: # definition/versions.yaml
Signed-off-by: Oksana Grishchenko <oksana.grishchenko@percona.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Today PostgreSQL logs, including pgaudit records, only exist as files on the data volume (
/pgdata/pgNN/log/postgresql-<Day>.log, overwritten weekly).kubectl logsshows only Patroni, and cluster log shippers never see them. Operator 3.1.0's log collector fixes that: a Fluent Bitlogssidecar streams PostgreSQL and pgBackRest logs to stdout as JSON lines, and alogrotatesidecar caps the files on the data volume (100 MB, 7 kept).What
New engine parameter
logCollector.enabled:truefalsespec.logcollectorwith the image but withoutenabled; the operator turns it on when it creates the cluster and otherwise keeps the cluster's current state. So upgrading the provider doesn't restart existing instances. The operator resolves this in memory and doesn't writeenabledback, so nothing conflicts with the provider's apply.fluentbitcatalog entry (percona/fluentbit:5.1.1-1, the one in the 3.1.0cr.yaml), so it can be overridden/mirrored. Explicitly enabling it without a catalog image is rejected byValidate.defaultValue: trueon create andfalsein edit mode (edit mode leaves unset values undefined, so atruedefault would turn it on for existing instances on any save of that section).Testing
Validate),go test -race ./...andmake lintpass.enabledunset →logs+logrotatesidecars;enabledunset → no sidecars, same pod (no restart);enabled: true→ sidecars added;enabled: false→ sidecars removed;kubectl logs <pod> -c logsshows PostgreSQL lines as JSON, including pgaudit records (AUDIT: SESSION,1,1,DDL,CREATE TABLE,...).Known limitation
An instance created through the API with
enabledunset has the collector on, but the edit form shows the toggle off; saving the Advanced Configuration section would then writefalse. Documented in the README (setenabledexplicitly when creating through the API). Custom Fluent Bit outputs (S3, OTel) and logrotate overrides are left for a follow-up.