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

Configure Patroni Logs to be stored in a file #4047

Merged
merged 1 commit into from
Dec 18, 2024
Merged

Conversation

tjmoore4
Copy link
Contributor

@tjmoore4 tjmoore4 commented Dec 9, 2024

Checklist:

  • Have you added an explanation of what your changes do and why you'd like them to be included?
  • Have you updated or added documentation for the change, as applicable?
  • Have you tested your changes on all related environments with successful results, as applicable?
    • Have you added automated tests?

Type of Changes:

  • New feature
  • Bug fix
  • Documentation
  • Testing enhancement
  • Other

What is the current behavior (link to any open issues here)?
Patroni is configured to send logs to stdout

What is the new behavior (if this is a feature change)?

  • Breaking change (fix or feature that would cause existing functionality to change)

This change allows for the configuration of the Postgres instance
Patroni logs to go to a file on the 'pgdata' volume instead of to
stdout. This file is located at '/pgdata/patroni/log/patroni.log'.

Both the log size limit and log level are configurable; only the
size limit setting is required. If not set, the default behavior
of sending all logs to stdout is maintained.

Changes to this configuration require a reload to take effect.

Other Information:
Issue: PGO-1701

@tjmoore4
Copy link
Contributor Author

tjmoore4 commented Dec 9, 2024

📝 We have a story in our backlog to address the linter issue separately, so I'll leave that only for now.

internal/patroni/config.go Outdated Show resolved Hide resolved
@tjmoore4 tjmoore4 force-pushed the patroni-log-to-file branch from 18c5a4b to b076535 Compare December 11, 2024 22:59
@tjmoore4 tjmoore4 marked this pull request as draft December 11, 2024 23:00
@tjmoore4 tjmoore4 force-pushed the patroni-log-to-file branch from 46ae3da to 590f899 Compare December 13, 2024 20:32
@tjmoore4 tjmoore4 marked this pull request as ready for review December 13, 2024 20:35
@tjmoore4 tjmoore4 force-pushed the patroni-log-to-file branch from 590f899 to 4dbba67 Compare December 13, 2024 20:40
@tjmoore4 tjmoore4 force-pushed the patroni-log-to-file branch 5 times, most recently from ededc3b to 45f3909 Compare December 17, 2024 20:08
@tjmoore4 tjmoore4 force-pushed the patroni-log-to-file branch from 45f3909 to 073ec5d Compare December 18, 2024 15:50
This commit allows for the configuration of the Postgres instance
Patroni logs to go to a file on the 'pgdata' volume instead of to
stdout. This file is located at '/pgdata/patroni/log/patroni.log'.

Both the log size limit and log level are configurable; only the
size limit setting is required. If not set, the default behavior
of sending all logs to stdout is maintained.

Changes to this configuration require a reload to take effect.

- https://patroni.readthedocs.io/en/latest/yaml_configuration.html#log

Issue: PGO-1701
@tjmoore4 tjmoore4 force-pushed the patroni-log-to-file branch from 073ec5d to fa85a98 Compare December 18, 2024 16:09
if sizeInBytes < 25000000 {
// TODO(validation): Eventually we should be able to remove this in favor of CEL validation.
// - https://kubernetes.io/docs/reference/using-api/cel/
r.Recorder.Eventf(cluster, corev1.EventTypeWarning, "PatroniLogStorageLimitTooSmall",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 I updated this from a normal event to a warning event. This is more in line with our existing patterns and what seems to me to be typical usage.

@tjmoore4 tjmoore4 merged commit a81b990 into main Dec 18, 2024
17 checks passed
@tjmoore4 tjmoore4 deleted the patroni-log-to-file branch December 18, 2024 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants