Check ID:
Provider: Azure
Service:
Severity: MEDIUM
Categories:
Resource type:
postgresql_flexible_server_log_retention_days_greater_3Provider: Azure
Service:
postgresqlSeverity: MEDIUM
Categories:
loggingResource type:
microsoft.dbforpostgresql/flexibleserversWhat this check verifies
Log retention on Azure Database for PostgreSQL Flexible Server is governed bylog_retention_days. Configuration is assessed as set and within 4-7 days versus unset or outside this range.
Risk
Insufficient or disabled log retention limits the audit trail needed to detect brute-force, SQL injection, or insider misuse, impeding investigation. Excessive retention enlarges exposure if logs are accessed, risking sensitive query data leakage and policy violations. This reduces visibility and weakens confidentiality and integrity.Recommendation
Setlog_retention_days to 4-7 to balance visibility and exposure. Export logs to centralized SIEM or secure storage for longer retention and analysis. Enforce least privilege, encryption, and immutability on log data, and monitor for gaps. Apply defense in depth with alerts on anomalous queries and failed logins.
Remediation
- CLI
- Terraform
- Native IaC
- Dashboard steps
az postgres flexible-server parameter set —resource-group <RESOURCE_GROUP> —server-name <SERVER_NAME> —name logfiles.retention_days —value 7
References
- https://learn.microsoft.com/en-us/azure/postgresql/monitor/concepts-logging
- https://www.trendmicro.com/cloudoneconformity-staging/knowledge-base/azure/PostgreSQL/log-retention-days.html
Where this check fires
This check runs on every scheduled scan against your Azure account. Findings appear at Cloud Security → Findings filterable byCheck ID = postgresql_flexible_server_log_retention_days_greater_3. To re-evaluate after a fix, hit Run now on the account’s schedule under Cloud Security → Schedules — the next scan re-checks this control and marks the finding fixed or keeps it persistent.
← Back to Azure checks