log_disconnections
Read PG 18 manual ↗Causes session terminations to be logged.
- Type
- bool
- Context
- superuser-backend
- Measured default
- off
- Unit
- —
- Metadata snapshot
- 18
Definition PG 18 manual
Causes session terminations to be logged. The log output provides information similar to log_connections, plus the duration of the session. Only superusers and users with the appropriate SET privilege can change this parameter at session start, and it cannot be changed at all within a session. The default is off.
Measured default history
| Version interval | Default |
|---|---|
| 9.0 – 19 | off |
Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗
How it works
log_disconnections logs end of a session, including duration. The record is emitted at session end and includes session duration, pairing naturally with connection-start identity but not proving that every abrupt failure reached the logger.
log_disconnections has SUPERUSER_BACKEND context: configuration changes apply when a new backend session starts and require superuser-level authority; established sessions keep their startup value.
It changes emitted diagnostic data rather than query semantics, but volume, sensitive content, log_line_prefix, destinations, collector throughput, and retention determine operational cost and usefulness.
Operational considerations
Expecting existing sessions to inherit a new log_disconnections value even though it is fixed when each backend starts.
Enabling richer logging without budgeting collector throughput, storage, retention, and downstream query cost.
Writing SQL text, bind values, identities, or host data without a redaction and access-control policy.
Changing log_disconnections globally without a rollback plan and a client or operational compatibility test.
Workload guidance
OLAP: Analytical jobs can justify richer log_disconnections telemetry, but account for long statements, large bind values, and bursty completion patterns in the log pipeline.
OLTP: Tune log_disconnections against an explicit observability question and a measured log-volume budget. Prefer selective thresholds, sampling, or role-level overrides over indiscriminate capture.
SMALL: Keep log_disconnections useful but bounded: verify disk, collector, retention, and redaction capacity before increasing detail or frequency.
Version history 3
- PG 14 → 15changed
- PG 9.4 → 9.5changed
- PG 9.0 → 9.1changed
Related entries
Further reading
Definition snapshot: english-manuals:7ed9023746be4ba3ab26a0811aa… · English manual source