Check ID: cloudsql_instance_postgres_log_min_error_statement_flag
Provider: GCP
Service: cloudsql
Severity: MEDIUM
Categories: logging
Resource type: sqladmin.googleapis.com/Instance

What this check verifies

Cloud SQL for PostgreSQL uses the log_min_error_statement flag and expects it set to error, the severity threshold that controls when SQL text is logged with error messages.

Risk

An incorrect threshold skews visibility and exposure:
  • Lower than error: logs excessive SQL, risking confidentiality loss and alert noise (monitoring availability).
  • Higher than error: omits query context for real errors, weakening audit trail integrity and incident response.

Recommendation

Set log_min_error_statement to error to balance insight and exposure. Enforce a logging policy that limits sensitive data in queries and supports defense in depth. Periodically review severity and retention to match workload and compliance needs and maintain reliable forensic readiness.

Remediation

gcloud sql instances patch <example_resource_name> --database-flags=log_min_error_statement=error

References

Where this check fires

This check runs on every scheduled scan against your GCP account. Findings appear at Cloud Security → Findings filterable by Check ID = cloudsql_instance_postgres_log_min_error_statement_flag. To re-evaluate after a fix, hit Run now on the account’s schedule under Cloud Security → Schedules — the next scan re-checks this control and marks the finding fixed or keeps it persistent.
← Back to GCP checks