Cloud SQL PostgreSQL instances should have 'log_temp_files' set to '0'
PostgreSQL can create a temporary file for actions such as sorting, hashing and temporary query results when these operations exceed work_mem. The log_temp_files flag controls logging names and the file size when it is deleted. Configuring log_temp_files to 0 causes all temporary file information to be logged, while positive values log only files whose size is greater than or equal to the specified number of kilobytes. A value of -1 disables temporary file information logging.
Temporary files are not logged by default. To log all temporary files, a value of 0 should set in the log_temp_files flag.
What this control checks
Cloud SQL PostgreSQL log_temp_files database flag must be set to 0.
Common pitfalls
Temporary files are not logged by default
Temporary files are not logged by default.
Value of -1 disables temporary file logging
A value of -1 disables temporary file information logging. Positive values log only files whose size is greater than or equal to the specified number of kilobytes.
Audit evidence
Evidence that deployed resources meet this control: PowerPipe control gcp_compliance.control.sql_instance_postgresql_log_temp_files_database_flag_0.
Scans of the Terraform code that flag the same setting before deployment: Trivy check GCP-0014.
Framework-specific interpretation
CIS GCP Benchmark v1.2.0: Mapped to 6.2.15 (Ensure that the 'log_temp_files' database flag for Cloud SQL PostgreSQL instance is set to '0').
Framework mappings
The clauses this control is mapped to in each framework.
- 6.2.15 Ensure that the 'log_temp_files' database flag for Cloud SQL PostgreSQL instance is set to '0'
Related controls
- Cloud SQL PostgreSQL instances should have 'log_duration' set to 'on'
- Cloud SQL PostgreSQL instances should have 'log_connections' set to 'on'
- Cloud SQL PostgreSQL instances should have 'log_min_duration_statement' set to '-1' (disabled)
- Cloud SQL PostgreSQL instances should have 'log_error_verbosity' set to 'DEFAULT' or stricter
Tool mappings
Use these identifiers to cross-reference this control across tools, reports, and evidence.
- Compliance.tf Control:
sql_instance_postgresql_log_temp_files_database_flag_0 - Powerpipe Control:
gcp_compliance.control.sql_instance_postgresql_log_temp_files_database_flag_0 - Trivy Check:
GCP-0014
Last reviewed: 2026-10-10