PostgreSQL Database configuration ‘log_retention days’ should be greater than 3

Description

Enabling log_retention_days helps PostgreSQL Database to Sets number of days a log file is retained which in turn generates query and error logs. Query and error logs can be used to identify, troubleshoot, and repair configuration errors and sub-optimal performance.

Portal Remediation Steps

  • Navigate to Azure Database for PostgreSQL servers.

  • Select the PostgreSQL server.

  • In the left navigation, select Server parameters.

  • In log_retention_days, set the retention period to be greater than 3 days.

  • Click Save.

CLI Remediation Steps

  • To enable log_retention_days greater than 3:

az postgres server configuration set --resource-group <resourceGroupName> --server-name <serverName> --name log_retention_days --value 4