pgBadger for Log Analysis
Run pgBadger over Postgres logs to produce HTML reports of slow queries, lock waits, and connection patterns.
What pgBadger Is
A Perl-based PostgreSQL log analyser that produces beautiful HTML reports of slow queries, lock waits, errors, connection patterns. Run it periodically against your logs.
Configure Logging
postgresql.conf:
log_destination = 'csvlog'
logging_collector = on
log_directory = 'pg_log'
log_min_duration_statement = '500ms'
log_lock_waits = on
log_temp_files = 0
log_checkpoints = on
log_connections = on
log_disconnections = on
log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h 'All lessons in this course
- pg_stat_statements: Top Queries
- pgBadger for Log Analysis
- Connection Pooling: PgBouncer
- Capacity Planning and Bloat Audits