MEDIUM
Source
Trivy
ID
AVD-GCP-0022

Ensure that logging of disconnections is enabled.

Logging disconnections 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 disconnection 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_disconnections"
      value = "on"
    }
  }
}