Parameter · Reporting and Logging / What to Log
log_connections
Logs specified aspects of connection establishment and setup.
- Default:
'' (empty) - Type: string
- Applies: New connections (superuser)
In plain words
Logs what happens when a client connects: that a connection arrived, who it authenticated as and how, and that it was allowed into a database. In PostgreSQL 18 you can choose which of these steps to log, and also how long setting up the connection took.
It is off (empty) by default; many sites turn it on for auditing.
For DBAs and operators
Changed in PostgreSQL 18: it is now a list of options instead of a boolean: receipt, authentication, authorization, setup_durations, or all. For compatibility on still works and equals receipt,authentication,authorization; off and '' log nothing. Real output with all:
The authenticated line names the pg_hba.conf line that matched (great for "why can't I log in" cases); the connection ready line (new) breaks down setup cost, helping prove that a pooler is needed when fork + authentication dominate short sessions. Failed logins log FATAL lines regardless of this setting.
Can only be changed at connection start (superuser via PGOPTIONS, or reload for new sessions). Pair with log_disconnections for session durations. On busy systems with thousands of connections per second this is a lot of lines.
How to change it
Applies at connection start; superusers can also pass it as a connection option.
See it in context
Client authentication Postmaster Client backend Process model
Related parameters
log_disconnections log_hostname application_name authentication_timeout log_line_prefix