-
Notifications
You must be signed in to change notification settings - Fork 18
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
Update logging: bump lib and introduce pebble log forwarding #486
Conversation
self, | ||
logs_scheme={"postgresql": {"log-files": POSTGRES_LOG_FILES}}, | ||
relation_name="logging", | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that, while LogProxyConsumer is streaming everything from
POSTGRES_LOG_FILES = [
"/var/log/pgbackrest/*",
"/var/log/postgresql/patroni.log",
"/var/log/postgresql/postgresql*.log",
]
using LogForwarder streams the stdout of all pebble services.
The two may differ. If critical, then could add a pebble service analogue to tail -f
the files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like there's a way to config pg to log to stdout, but I'm not clear on the syntax.
https://www.postgresql.org/docs/current/runtime-config-logging.html#GUC-LOGGING-COLLECTOR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think a tailing service or stdout will work for Pgbackrest out of the box. IIRC it creates separate log files for various commands. I don't see an option to configure the logfile names. Maybe we can use --log-level-console
and run the backup commands as a oneshot pebble service?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably can also use something like --log-level-console
along with container.exec([pgbackrest-command])wait_output()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #486 +/- ##
==========================================
+ Coverage 70.71% 70.76% +0.04%
==========================================
Files 11 11
Lines 2926 2931 +5
Branches 511 511
==========================================
+ Hits 2069 2074 +5
Misses 748 748
Partials 109 109 ☔ View full report in Codecov by Sentry. |
Issue
Solution
Related to:
jujuversion
operator#1230Testing
Deploy the bundle:
Confirm the pebble plan has a
log-targets
section:juju exec --unit pg/0 -- PEBBLE_SOCKET=/charm/containers/postgresql/pebble.socket pebble plan
Confirms logs are in loki:
Trimmed down output: