PostgreSQL disconnection logging is disabled

PostgreSQL disconnection logs help investigate when sessions end and how long they last.

Description

log_disconnections records when a PostgreSQL session ends and how long it lasted.

Potential impact

Missing termination records make repeated reconnects or unusually long sessions harder to investigate. To identify the cause of a disconnect or the SQL that ran, use other records.

Remediation

On Flexible Server, set log_disconnections to on. Open and close a new test session, then find its end time and duration in the collected logs. Retain the records alongside connection and error logs so investigators can match the session. Limit who can read them.

Examples

The first task targets Single Server, which retired on March 28, 2025. The second requires an existing Flexible Server and azure.azcollection 3.18.0 or later.

Before

yaml
- name: PostgreSQL 설정 변경
  azure.azcollection.azure_rm_postgresqlconfiguration:
    resource_group: myResourceGroup
    server_name: myServer
    name: log_disconnections
    value: "off"

After

yaml
- name: PostgreSQL 설정 변경
  azure.azcollection.azure_rm_postgresqlflexibleconfiguration:
    resource_group: myResourceGroup
    server_name: myServer
    name: log_disconnections
    value: "on"

References