The server should have the 'log_duration' parameter set to 'ON'

이 페이지는 아직 한국어로 제공되지 않으며 번역 작업 중입니다. 번역에 관한 질문이나 의견이 있으시면 언제든지 저희에게 연락해 주십시오.

Description

PostgreSQL uses logging to track the time it takes to complete an SQL query.

Rationale

The “log_duration” parameter allows recording the duration of each completed PostgreSQL statement. Logging this attribute enables administrators to monitor for potential issues in the database.

Remediation

From the console

  1. Complete steps in Microsoft’s Customize server configuration parameters for Azure Database for PostgreSQL documentation to enable the ’log_duration’ logging in the PostgreSQL database. Ensure log_duration is selected under Server Parameters.

From the command line

  1. Complete steps in Microsoft’s Customize server configuration parameters for Azure Database for PostgreSQL documentation to enable log_duration in Server Parameters.

  2. Get a list of your PostgreSQL servers by running the following in Azure Powershell:

        az postgres server list
    	--output table
    	--query '[*].{name:name, resourceGroup:resourceGroup}'
        
  3. Run the ‘postgres server configuration set’ command:

        az postgres server configuration set
    	--server-name "INSERT-SERVER-NAME-HERE-FROM-STEP-2"
    	--resource-group "cloud-shell-storage-westeurope"
    	--name log_duration
    	--value on
        
  4. Repeat steps two and three for each server that is not configured correctly.