{"Entry":{"collection":"guc","key":"log_disconnections","name":"log_disconnections","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Reporting and Logging / What to Log","category_zh":"","changed_in":["9.5"],"changes":[{"documentation_changed":false,"fields":{},"from":"7.4","status":"added","to":"8.0"},{"documentation_changed":true,"fields":{},"from":"8.0","status":"changed","to":"8.1"},{"documentation_changed":true,"fields":{},"from":"8.1","status":"changed","to":"8.2"},{"documentation_changed":true,"fields":{},"from":"9.0","status":"changed","to":"9.1"},{"documentation_changed":true,"fields":{"context":{"from":"backend","to":"superuser-backend"}},"from":"9.4","status":"changed","to":"9.5"},{"documentation_changed":true,"fields":{},"from":"14","status":"changed","to":"15"}],"content_hash":"2547de1cf6567b563f450968f32093955b1b1c5fff1d6740bf8cc5d218f1675c","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"off"}],"editorial":{"advice":{"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."},"mechanism":["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."],"pitfalls":["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."],"references":[{"title":"PostgreSQL 19 Beta 4: log_disconnections","url":"https://www.postgresql.org/docs/19/runtime-config-logging.html#GUC-LOG-DISCONNECTIONS"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["log_statement","log_duration","log_connections","log_parameter_max_length","log_parameter_max_length_on_error"],"summary":"log_disconnections is the PostgreSQL setting that controls whether PostgreSQL logs end of a session, including duration."},"enumvals":[],"first_version":"8.0","group":"Reporting and Logging","group_slug":"logging","imported_at":"2026-09-30T00:40:57.309795+08:00","intro_commit":{},"key":"log_disconnections","last_version":"20","max_val":"","min_val":"","name":"log_disconnections","position":223,"present_in":["8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"short_desc":"Causes session terminations to be logged.","short_desc_zh":"","source_rev":"english-manuals:4b00ee60d267a61e5d4d3ad4c9c633ce723dff033e3d7be0111ab2d173b41105","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"log_disconnections","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"log_disconnections","SourceRevision":"english-manuals:4b00ee60d267a61e5d4d3ad4c9c633ce723dff033e3d7be0111ab2d173b41105","Facts":{"boot_val":"off","category":"Reporting and Logging / What to Log","context":"superuser-backend","description":"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.","doc":{"anchor":"GUC-LOG-DISCONNECTIONS","file":"runtime-config-logging.html","lang":"en","sha256":"93c48c522a72fca19705c4c91a71e951eae653662008eee2e4a9a74a11127fde","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"log_disconnections","short_desc":"Logs end of a session, including duration.","source":"pg-settings-source-snapshot","unit":null,"vartype":"bool"},"ManualEvidence":{"doc":{"anchor":"GUC-LOG-DISCONNECTIONS","file":"runtime-config-logging.html","lang":"en","sha256":"93c48c522a72fca19705c4c91a71e951eae653662008eee2e4a9a74a11127fde","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"log_disconnections","SourceDatabase":"center","Version":"18","Locale":"en","Title":"log_disconnections","Summary":"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.","BodyHTML":"\u003cp\u003eCauses 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.\u003c/p\u003e","SourceRevision":"english-manuals:4b00ee60d267a61e5d4d3ad4c9c633ce723dff033e3d7be0111ab2d173b41105","ContentHash":"b12a4d3468be1e816f3bfee1977dcf91f348a0c41b75fc0be3d4a36fac453d8c","Payload":{"description":"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."}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","15","16","17","18","19","20","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
