Description
RDS PostgreSQL log_duration records the duration of completed SQL statements. Missing duration information can hinder analysis of performance degradation and unusual load. This setting alone does not record SQL statement text or every security event.
Potential impact
- Slow operations and long-running patterns can be harder to analyze.
- Identifying incidents and improving performance can take longer.
Remediation
Set log_duration to ON where supported by the PostgreSQL parameter set and verify the resulting logs. Configure related logs and thresholds needed to analyze slow SQL statements, and manage log volume, retention costs and access to sensitive information.
Examples
These excerpts compare PostgreSQL duration logging. Select version and instance specifications for the target environment, and configure other creation settings separately.
Before
resource "alicloud_db_instance" "default" {
engine = "PostgreSQL"
engine_version = var.postgresql_version
instance_type = var.db_instance_type
instance_storage = var.db_instance_storage
parameters {
name = "log_duration"
value = "OFF"
}
}
After
resource "alicloud_db_instance" "default" {
engine = "PostgreSQL"
engine_version = var.postgresql_version
instance_type = var.db_instance_type
instance_storage = var.db_instance_storage
parameters {
name = "log_duration"
value = "ON"
}
}
The after example enables duration records for completed SQL statements. If statement text is needed, verify the related logging settings separately.