For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/ansible-azure-postgresql-log-duration-not-set.md.
A documentation index is available at /llms.txt.
Enable the PostgreSQL server parameter log_duration to record statement execution durations. Without duration logging, slow queries and malicious long-running activity can go undetected, hindering timely detection and forensic investigation.
In Ansible tasks using the azure.azcollection.azure_rm_postgresqlconfiguration or azure_rm_postgresqlconfiguration module, the parameter entry with name: log_duration must have value: 'ON'. Tasks missing the value property or with a value other than ON (case-insensitive) are flagged.
Secure Ansible task example:
- name:Enable log_duration for PostgreSQL serverazure.azcollection.azure_rm_postgresqlconfiguration:resource_group:myResourceGroupserver_name:myPostgresServername:log_durationvalue:"ON"