PostgreSQL database instance ‘log_temp_files’ database flag should be set to ‘0’ (on)


The PostgreSQL database instance flag ‘log_temp_files’ controls logging temporary files and their size when deleted. Setting this flag to 0 causes all temporary files to be logged. If any temporary files are not logged, it may be more difficult to identify potential performance issues due to either poor application coding or deliberate resource starvation attempts.

Remediation Steps

Google Cloud Console

  • Navigate to Cloud SQL instances.

  • Click on the Cloud SQL PostgreSQL database instance name to go to the Overview page.

  • Click EDIT and scroll down to the Flags section.

  • Select ADD FLAG, choose the log_temp_files flag, and set it 0.

  • Click DONE.

gcloud CLI

  • Set the log_temp_files database flag to 0 for each Cloud SQL PostgreSQL database instance:

    • gcloud sql instances patch INSTANCE_NAME --database-flags log_temp_files=0