CIS Google Cloud Platform Foundation Benchmark v1.2.0/Cloud SQL Database Services - PostgreSQL Database/68 of 83
6.2.15Ensure that the 'log_temp_files' database flag for Cloud SQL PostgreSQL instance is set to '0' (on)
Control family: Cloud SQL Database Services - PostgreSQL Database
Control description
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.
How to implement
ResponsibilityCustomerYou configure and operate this in your own cloud accounts.
PostgreSQL writes temporary files when a query outgrows its working memory. Setting log_temp_files to 0 logs every one with its size, which reveals runaway queries and heavy data pulls that might be someone extracting data.
Before you start
The same on every cloud, before the steps in the tabs.
- Record in the PostgreSQL configuration standard that log_temp_files is 0, so every new instance starts with it.
- Agree who reviews large temporary files, which can show runaway queries or data extraction.
Evidence
- The PostgreSQL configuration standard
Not applicable. This benchmark covers Google Cloud only.
Not applicable. This benchmark covers Google Cloud only.
On Google Cloud the tasks set the flag on each PostgreSQL instance in Cloud SQL, then watch for instances without it with Security Command Center.
Task 1Set log_temp_files to 0 on each PostgreSQL instance
- Sign in to the Google Cloud console at console.cloud.google.com and open SQL.
- Choose the PostgreSQL instance and select Edit.
- Expand Database flags (shown as Flags on some instances) and choose Add a database flag, or find the flag if it is already listed.
- Choose log_temp_files and set it to 0, then choose Done.
- Choose Save; if the console says the change restarts the instance, schedule it for a quiet period first.
- Check it: the instance Overview lists log_temp_files with the value 0 under Database flags.
Task 2Keep it checked with the Security Health Analytics finding SQL_LOG_TEMP_FILES
- Open Security Command Center > Findings for the organization (Security Health Analytics runs on the Premium tier for most detectors).
- In the query editor, filter on category SQL_LOG_TEMP_FILES with state ACTIVE, and select Apply.
- Open each finding, read the resource and the explanation it gives, and set the flag on the instance it names.
- Check it: after the next Security Health Analytics scan, no active SQL_LOG_TEMP_FILES finding remains.
Evidence
- The Overview of each PostgreSQL instance, listing log_temp_files set to 0 under Database flags
- Security Command Center, with no active SQL_LOG_TEMP_FILES finding
Console steps as of 5 November 2026. Not every step has been confirmed in a live console yet, and menus and labels can move between releases, so look for the nearest match if one has changed.