PostgreSQL 'log_min_error_statement' database flag is not set appropriately Affecting Cloud SQL service in Google


Severity

0.0
medium
0
10
Severity Framework
Snyk CCSS
Rule category
Logging/ Configuration

Is your environment affected by this misconfiguration?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
Frameworks
CIS-ControlsCIS-GoogleHIPAAISO-27001NIST-800-53SOC-2
  • Snyk IDSNYK-CC-00368
  • creditSnyk Research Team

Description

The PostgreSQL database instance flag 'log_min_error_statement' controls which message levels are written to the server log. Valid values include INFO, WARNING (default), and ERROR. If this flag is not set to the correct value, important messages useful for troubleshooting may not be logged.

How to fix?

Set the settings.database_flags.name attribute to "log_min_error_statement and settings.database_flags.value attribute to "info", "warning", or "error".

Example Configuration

resource "google_sql_database_instance" "default" {
  name                = "all-valid-flags-pg-instance"
  database_version    = "POSTGRES_11"
  region              = "us-east1"
  deletion_protection = false

  settings {
    tier = "db-f1-micro"

    database_flags {
      name  = "log_min_error_statement"
      value = "error"
    }
  }
}