MEDIUM
Source
Trivy
ID
AVD-GCP-0020

Ensure that logging of lock waits is enabled.

Lock waits are often an indication of poor performance and often an indicator of a potential denial of service vulnerability, therefore occurrences should be logged for analysis.

Impact

Follow the appropriate remediation steps below to resolve the issue.

Enable lock wait logging.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
resource "google_sql_database_instance" "db" {
  name             = "db"
  database_version = "POSTGRES_12"
  region           = "us-central1"
  settings {
    database_flags {
      name  = "log_lock_waits"
      value = "on"
    }
  }
}