Check ID:
Provider: GCP
Service:
Severity: MEDIUM
Categories:
Resource type:
cloudsql_instance_postgres_log_min_duration_statement_flagProvider: GCP
Service:
cloudsqlSeverity: MEDIUM
Categories:
loggingResource type:
sqladmin.googleapis.com/InstanceWhat this check verifies
Cloud SQL for PostgreSQL evaluates whetherlog_min_duration_statement is set to -1, disabling statement duration logging.
Risk
When duration-based statement logging is enabled, logs can capture full SQL with literals, exposing confidential data in log stores. Adversaries or over-privileged users could harvest secrets/PII, profile schemas, and support lateral movement. Heavy logging can also raise costs and impact availability under load.Recommendation
Keeplog_min_duration_statement at -1 in production to avoid writing sensitive query text to logs. Apply least privilege to log access, enforce data minimization with redaction and short retention. If troubleshooting is required, enable narrowly and temporarily, prefer non-prod, and monitor access.
Remediation
- CLI
- Terraform
- Dashboard steps
References
- https://www.trendmicro.com/trendaivisiononecloudriskmanagement/knowledge-base/gcp/CloudSQL/configure-log-min-error-statement-flag.html
- https://cloud.google.com/sql/docs/postgres/flags
Where this check fires
This check runs on every scheduled scan against your GCP account. Findings appear at Cloud Security → Findings filterable byCheck ID = cloudsql_instance_postgres_log_min_duration_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