Causes aspects of each connection to the server to be logged.
At a glance
| Property | Value |
|---|---|
| Parameter | log_connections |
| Category | Error Reporting and Logging |
| Default | the empty string, '', which disables all connection logging |
| Value type | string |
| Change scope | Per-session (SET) |
| Available in | PostgreSQL 12, 13, 14, 15, 16, 17, 18, 19 (added in 12) |
What it does
Causes aspects of each connection to the server to be logged. The default is the empty string, ”, which disables all connection logging. The following options may be specified alone or in a comma-separated list:
Disconnection logging is separately controlled by log_disconnections.
(Description quoted from the official PostgreSQL documentation.)
How to apply a change
Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.
Inspect the current value and source with SHOW log_connections; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'log_connections';.
Tuning guidance
Tune this for observability versus log volume, not for raw performance. More verbose logging helps diagnose problems but costs disk and I/O; quieter logging saves space but hides detail. Pick a level your log pipeline can store and search, and raise verbosity temporarily when investigating an incident.