---
title: The server should have the 'log_duration' parameter set to 'ON'
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > OOTB Rules > The server should have the
  'log_duration' parameter set to 'ON'
---

# The server should have the 'log_duration' parameter set to 'ON'
 
## Description{% #description %}

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

## Rationale{% #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{% #remediation %}

### From the console{% #from-the-console %}

1. Complete steps in Microsoft's [Customize server configuration parameters for Azure Database for PostgreSQL](https://docs.microsoft.com/en-us/azure/postgresql/howto-configure-server-parameters-using-portal) documentation to enable the 'log_duration' logging in the PostgreSQL database. Ensure **log\_duration** is selected under **Server Parameters**.

### From the command line{% #from-the-command-line %}

1. Complete steps in Microsoft's [Customize server configuration parameters for Azure Database for PostgreSQL](https://docs.microsoft.com/en-us/azure/postgresql/howto-configure-server-parameters-using-cli) documentation to enable **log\_duration** in **Server Parameters**.

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

   ```powershell
       az postgres server list
   	--output table
   	--query '[*].{name:name, resourceGroup:resourceGroup}'
       
```

1. Run the 'postgres server configuration set' command:

   ```powershell
       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
       
```

1. Repeat steps two and three for each server that is not configured correctly.
