# Enable log_disconnections Parameter on Azure PostgreSQL Servers for Enhanced Session Auditing

- Source: https://support.icompaas.com/support/solutions/articles/62000234794-enable-log-disconnections-parameter-on-azure-postgresql-servers-for-enhanced-session-auditing
- Section: [Solutions](https://support.icompaas.com/support/solutions) › [Azure Database Services Benchmark v1.0.0](https://support.icompaas.com/support/solutions/62000112693) › [Azure Database Services Benchmark](https://support.icompaas.com/support/solutions/folders/62000169261)
- Last updated: 2026-05-29
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

**Profile Applicability:**

-   **Level 1**  
    

**Description:** The log\_disconnections parameter in PostgreSQL controls whether the server logs every disconnection event, including the duration of each session. This parameter is essential for auditing and troubleshooting connection issues and provides insight into session behaviors and any unexpected disconnections.

**Rationale:** Enabling the log\_disconnections parameter allows the database to log the end of each session, which includes valuable information such as the session duration. This helps with troubleshooting, identifying potential unauthorized activities, and understanding the overall usage pattern of database resources.

**Impact:**

-   Pros:  
    
    -   Helps monitor session activities, providing insights into potential security incidents and performance issues.  
        
    -   Useful for auditing and detecting any unusual or malicious disconnections.  
        
    -   Assists in diagnosing session or connection-related issues.  
        
-   Cons:  
    
    -   Generates additional log data, which may increase storage requirements.  
        
    -   Can lead to log overload on high-traffic systems, potentially causing performance degradation if not managed properly.  
        

**Default Value:**

By default, log\_disconnections is set to OFF.

**Pre-requisites:** Ensure that PostgreSQL logging is enabled and log management is properly configured to handle the logs generated.

**Remediation**

**Test Plan:**

**Using Azure Portal:**

1.  Log in to Azure Portal: [https://portal.azure.com](https://portal.azure.com/).  
    
2.  Navigate to Azure Database for PostgreSQL Servers.  
    
3.  Select the relevant PostgreSQL server.  
    
4.  Under Settings, click on Server parameters.  
    
5.  Ensure that the log\_disconnections parameter is set to ON.
    

**Using Azure CLI:**1\. Run the following command to check the log\_disconnections setting:

az postgres server show --resource-group <resource-group-name> --name <server-name> --query "properties.parameters.log\_disconnections"

-   The output should show ON.  
    

**Implementation Plan:**

**Using Azure Portal:**

1.  Go to Azure Database for PostgreSQL Servers.  
    
2.  Select the server and go to Server parameters.  
    
3.  Set the log\_disconnections parameter to ON and click Save.
    

**Using Azure CLI:**1\.  To enable log\_disconnections, run the following command:

az postgres server configuration set --resource-group <resource-group-name> --server-name <server-name> --name log\_disconnections --value ON

  

**Backout Plan:**

**Using Azure Portal:**

1.  Go to Azure Database for PostgreSQL Servers.  
    
2.  Under Settings, click on Server parameters.  
    
3.  Set the log\_disconnections parameter back to OFF if necessary.
    

**Using Azure CLI:**1.  To disable log\_disconnections, run the following command:

az postgres server configuration set --resource-group <resource-group-name> --server-name <server-name> --name log\_disconnections --value OFF

  

**References:**

-   [PostgreSQL Server Configuration  
    ](https://docs.microsoft.com/en-us/azure/postgresql/howto-configure-server-parameters-using-portal)
    
-   [Azure PostgreSQL Logging Best Practices](https://docs.microsoft.com/en-us/azure/postgresql/single-server/logging)

## Related compliance guidance

- [SOC 2 compliance: a practical implementation guide for cloud-native SaaS teams](https://support.icompaas.com/compliance/soc-2-trust-services-criteria): Configuration checks like this one are the technical half of a SOC 2 / ISO 27001 programme — the guide shows where they fit, what else an auditor expects, and how to evidence them.
- [ISO/IEC 27001:2022 compliance: a practical implementation guide](https://support.icompaas.com/compliance/iso-27001-2022): ISO 27001 Annex A.8 (technological controls) is where cloud hardening evidence lands; the guide shows how to run the ISMS around it.
