For compliance and auditing purposes, ensure that your Azure PostgreSQL flexible database servers have a sufficient retention period configured for log files, i.e. greater than 3 days. The retention period, represented by the "logfiles.retention_days" parameter, is the number of days to retain log files for the databases hosted on Azure PostgreSQL flexible servers. The compliant value for the retention period is 4 to 7 days (inclusive).
A retention period of 4 days or more should allow you to collect the necessary amount of logging data required to identify and mitigate any PostgreSQL database security and performance issues. The logging data can contain query logs - useful for checking sub-optimal performance, and error logs - used to identify anomalies, potential security breaches, and unauthorized access to PostgreSQL flexible servers.
Audit
To determine the log files retention period configured for your Azure PostgreSQL flexible database servers, perform the following operations:
Remediation / Resolution
To extend the log files retention period for your Azure PostgreSQL flexible database servers, perform the following operations:
References
- Azure Official Documentation
- What is Azure Database for PostgreSQL - Flexible Server?
- List all server parameters
- Security Control: Logging and threat detection
- Azure Command Line Interface (CLI) Documentation
- az postgres flexible-server list
- az postgres flexible-server parameter show
- az postgres flexible-server parameter set