PostgreSQL database instance ‘log_min_messages’ database flag should be set appropriately

Description

The PostgreSQL database instance flag ‘log_min_messages’ controls which message levels are written to the server log. Valid values include INFO, WARNING, and ERROR. Each level includes all the levels that follow it. The default is WARNING. If this flag is not set to the correct value, important messages useful for troubleshooting may not be logged.

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_min_messages flag, and set it to an appropriate value such as error.

  • Click DONE.

gcloud CLI

  • Set the log_min_messages database flag to a value like error for each Cloud SQL PostgreSQL database instance:

    • gcloud sql instances patch INSTANCE_NAME --database-flags log_min_messages=error