Logging Not Just for Lumberjacks
summary
PostgreSQL logging turns on with one config change and rotates by default daily or at 10MB, so expect many files unless rotation/cleanup is scripted. Choose destination: eventlog on Windows, stderr, csvlog (easy to load into a table), or syslog for centralization. Use log_line_prefix with timestamp and pid so log_min_duration_statement can match durations to statements. Tools include tail/grep, Splunk/Logstash, and parsers like pg_badger (far faster than older php tools on large logs); auto_explain works but inflates logs.
AI-written summary · about
chapters (13)
- 0:00PostgreSQL logging basics
- 1:05Logs for troubleshooting and compliance
- 2:07Default logging setup
- 5:43Custom logging parameters
- 7:28What to log: connections, DDL, prefix
- 11:03When to log: levels and long queries
- 13:54Where to log: destinations
- 19:34Tools for log analysis
- 27:23Automated reporting with Splunk, Logstash
- 31:22PostgreSQL log parsers: pg Fuen, pg Badger
- 35:17Tweaking: SQL state codes, user logging, auto_explain
- 38:49Safety tips for logs and config
- 40:12Conclusion and contest
related talks
28mScaling the Wall of Text: Logging Best Practices in PostgreSQL
30mPostgreSQL Observability: The Log Configuration That Changes Everything
34mPglog: a flexible log analyser
49mLeveraging pgBadger for Effective PostgreSQL Troubleshooting
19mA New Approach to Logging as a Stack: Fluent Bit + PostgreSQL (FPS)
47mIdentifying Slow Queries and Fixing Them!
50mPostgreSQL Query Performance Insights
40mPoastgreSQL Auditing, Authentication, and Security
