CertGrid CertGrid
Hands-on Lab·PostgreSQL

PostgreSQL Server Log Configuration

logging_collector is off, pg_current_logfile() returns NULL, and there is still a log file. Then four settings that turn it into something worth reading.

Monitoring and Operations Guide 40 of 47 Intermediate

log_connections became a list in PostgreSQL 18 - receipt, authentication, authorization. on is still accepted and means all of them. On 17 and earlier it is a plain boolean.

Every command on this page ran on db-a01.
Server NameIP AddressOSRolesCPURAMHDD
db-a01192.168.0.81Ubuntu 26.04 LTSPrimary / Source / Replica Set Member 12 Core4 GB50 GB

This guide includes

Use this when pg_current_logfile() returns NULL and there is still a log. This matters because the packaging does not use the logging collector - so what matters is the prefix, and the three things actually worth logging.

Before you start

  1. Find the log the packaging actually uses

  2. Read the prefix

  3. Log the slow statements

  4. Log who connects, PostgreSQL 18 style

  5. Log the lock waits

  6. Put it back, and hit a role that will not drop

Official sources