MEDIUM
Source
Trivy
ID
AVD-GCP-0016

Ensure that logging of connections is enabled.

Logging connections provides useful diagnostic data such as session length, which can identify performance issues in an application and potential DoS vectors.

Impact

Follow the appropriate remediation steps below to resolve the issue.

Enable connection 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_connections"
      value = "on"
    }
  }
}