# 6.2.5 Ensure the ‘Log_min_messages’ Flag for a Cloud SQL PostgreSQL Instance Is Set to 'Warning' or Higher (Automated)

- Source: https://support.icompaas.com/support/solutions/articles/62000233036-6-2-5-ensure-the-log-min-messages-flag-for-a-cloud-sql-postgresql-instance-is-set-to-warning-or-h
- Section: [Solutions](https://support.icompaas.com/support/solutions) › [GCP Benchmarks](https://support.icompaas.com/support/solutions/62000112667) › [GCP Knowledge Bases](https://support.icompaas.com/support/solutions/folders/62000169178)
- Last updated: 2026-05-29
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

Profile Applicability:

-   Level 1

Description:

The log\_min\_messages flag determines the minimum severity level of messages that PostgreSQL will treat as error statements and log. Valid severity levels (from lowest to highest) include:

-   DEBUG5, DEBUG4, DEBUG3, DEBUG2, DEBUG1
    
-   INFO
    
-   NOTICE
    
-   WARNING
    
-   ERROR
    
-   LOG
    
-   FATAL
    
-   PANIC
    

Each level includes messages of higher severity. The recommended value for this flag is WARNING to ensure critical issues are logged without creating excessive noise. Changes should align with the organization's logging policy.

Rationale:

Proper logging of error messages is crucial for troubleshooting and forensic investigations. Setting log\_min\_messages to WARNING ensures that essential messages are logged while avoiding an overload of unnecessary information. This improves the ability to identify critical issues without sifting through verbose logs. However, organizations may adjust the setting to meet their specific security and operational needs.

Impact:

-   Setting the flag to a low severity (e.g., DEBUG) may lead to excessive logs, increasing storage requirements and complicating error identification.
    
-   Setting the flag to a higher severity (e.g., PANIC) may suppress important error messages, hindering troubleshooting efforts.
    
-   Changes to custom flags via the command line may overwrite existing flags, potentially causing unforeseen issues. Changes should be made during periods of low activity.
    

Default Value:

By default, the log\_min\_messages flag is set to ERROR.

Audit Steps:

#### Using Google Cloud Console:

1.  Navigate to the [Cloud SQL Instances](https://console.cloud.google.com/sql/instances) page.
    

                   ![](https://support.icompaas.com/assets/kb/9b5fde0c17ae9a79.png)

2.  Select the PostgreSQL instance to view its Instance Overview.
    

        ![](https://support.icompaas.com/assets/kb/ec7733ebac1e3963.png)

3.  Go to the Configuration card.
    

                       ![](https://support.icompaas.com/assets/kb/c76b89a964a2e05c.png)

4.  Verify the value of the log\_min\_messages flag aligns with the organization's logging policy (recommended: WARNING or stricter).
    

                     ![](https://support.icompaas.com/assets/kb/620672beb15a3826.png)

#### Using Google Cloud CLI:

Verify the log\_min\_messages value for each PostgreSQL instance:

gcloud sql instances describe \[INSTANCE\_NAME\] --format=json | jq '.settings.databaseFlags\[\] | select(.name=="log\_min\_messages")|.value'

Remediation Steps:

#### Using Google Cloud Console:

1.  Go to the [Cloud SQL Instances](https://console.cloud.google.com/sql/instances) page.
    

               ![](https://support.icompaas.com/assets/kb/92d0e8c408b5a3a6.png)

2.  Select the PostgreSQL instance that requires configuration.
    

  ![](https://support.icompaas.com/assets/kb/636eef6fb40c7031.png)

3.  Click Edit.
    

      ![](https://support.icompaas.com/assets/kb/857eaa646ac19a62.png)

4.  Scroll to the Flags section.
    

               ![](https://support.icompaas.com/assets/kb/d7eeecc63865810b.png)

5.  If the log\_min\_messages flag is not already set, click Add a Database Flag, choose log\_min\_messages from the dropdown menu, and set it to WARNING or higher.
    

                       ![](https://support.icompaas.com/assets/kb/79f42aaaf83f7cf9.png)

6.  Click Save.
    

                          ![](https://support.icompaas.com/assets/kb/48cabc3a2b4472e4.png)

7.  Verify the changes under the Flags section on the Overview page.
    

        ![](https://support.icompaas.com/assets/kb/b3f22464dcd392ba.png)

#### Using Google Cloud CLI:

Configure the log\_min\_messages flag for a PostgreSQL instance

gcloud sql instances patch \[INSTANCE\_NAME\] --database-flags log\_min\_messages=WARNING

1.  Note: This command overwrites previously set database flags. To retain existing flags, include them in the command along with the new flag.
    

Backout Plan:

Step 1: Revert log\_min\_messages to a Less Restrictive Value If Needed

gcloud sql instances patch <INSTANCE\_NAME> --database-flags "log\_min\_messages=NOTICE"

Step 2: Notify Security and Operations Teams

-   Inform security and database teams before making further changes.
    

Step 3: Restore from Backup (If Necessary)

-   If setting log\_min\_messages=WARNING causes operational issues, restore the PostgreSQL instance from a backup.
    

References:

1.  [Google Cloud SQL PostgreSQL Flags Documentation](https://cloud.google.com/sql/docs/postgres/flags)
    
2.  [PostgreSQL Runtime Configuration Logging](https://www.postgresql.org/docs/9.6/runtime-config-logging.html#RUNTIMECONFIG-LOGGING-WHEN)
    

Additional Information:

-   Adjusting the log\_min\_messages flag does not require a Cloud SQL instance restart.
    
-   **Some database flag changes may affect instance availability or stability and could void the Cloud SQL SLA. Review operational guidelines for more details.**
    
-   **Organizations should periodically review logging settings to ensure compliance with security policies and operational needs.**
    

**CIS Controls:**

<table style="border:none;border-collapse:collapse;font-family:&quot;Helvetica Neue&quot;"><colgroup style="font-family:&quot;Helvetica Neue&quot;"><col style="font-family:&quot;Helvetica Neue&quot;"><col style="font-family:&quot;Helvetica Neue&quot;"><col style="font-family:&quot;Helvetica Neue&quot;"><col style="font-family:&quot;Helvetica Neue&quot;"><col style="font-family:&quot;Helvetica Neue&quot;"></colgroup><tbody style="font-family:&quot;Helvetica Neue&quot;"><tr style="height:40pt;font-family:&quot;Helvetica Neue&quot;"><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><strong><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-weight:700;font-family:&quot;Helvetica Neue&quot;">Control</span></span></span></strong></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><strong><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-weight:700;font-family:&quot;Helvetica Neue&quot;">Description</span></span></span></strong></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><strong><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-weight:700;font-family:&quot;Helvetica Neue&quot;">IG 1</span></span></span></strong></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><strong><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-weight:700;font-family:&quot;Helvetica Neue&quot;">IG 2</span></span></span></strong></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><strong><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-weight:700;font-family:&quot;Helvetica Neue&quot;">IG 3</span></span></span></strong></span></p></td></tr><tr style="height:54.25pt;font-family:&quot;Helvetica Neue&quot;"><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;text-align:justify;font-size:14px"><span style="font-size:14px"><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-family:&quot;Helvetica Neue&quot;">8.5 Collect Detailed Audit Logs</span></span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;text-align:left;font-size:14px"><span style="font-size:14px"><strong><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-weight:400;font-family:&quot;Helvetica Neue&quot;">Enable detailed logging to capture sensitive data-related events, including source, timestamp, and user information.</span></span></span></strong></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;text-align:left;font-size:14px"><span style="font-size:14px"><strong><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-weight:400;font-family:&quot;Helvetica Neue&quot;">✅</span></span></span></strong></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;text-align:justify;font-size:14px"><span style="font-size:14px"><strong><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-weight:400;font-family:&quot;Helvetica Neue&quot;">✅</span></span></span></strong></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><div style="text-align:justify;font-size:14px"><span style="font-size:14px"><strong><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><br style="font-family:&quot;Helvetica Neue&quot;"></span></span></strong></span></div></td></tr><tr style="height:40pt;font-family:&quot;Helvetica Neue&quot;"><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;text-align:justify;font-size:14px"><span style="font-size:14px"><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-family:&quot;Helvetica Neue&quot;">6.3 Enable Detailed Logging</span></span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;text-align:left;font-size:14px"><span style="font-size:14px"><strong><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-weight:400;font-family:&quot;Helvetica Neue&quot;">Configure logging to include essential event details such as date, user, and source/destination addresses.</span></span></span></strong></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;text-align:left;font-size:14px"><span style="font-size:14px"><strong><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-weight:400;font-family:&quot;Helvetica Neue&quot;">✅</span></span></span></strong></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;text-align:justify;font-size:14px"><span style="font-size:14px"><strong><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><span style="font-weight:400;font-family:&quot;Helvetica Neue&quot;">✅</span></span></span></strong></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><div style="text-align:justify;font-size:14px"><span style="font-size:14px"><strong><span style="color:rgb(0, 0, 0)"><span style="font-family:Helvetica Neue"><br style="font-family:&quot;Helvetica Neue&quot;"></span></span></strong></span></div></td></tr></tbody></table>

## Related compliance guidance

- [SOC 2 compliance: a practical implementation guide for cloud-native SaaS teams](https://support.icompaas.com/compliance/soc-2-trust-services-criteria): Configuration checks like this one are the technical half of a SOC 2 / ISO 27001 programme — the guide shows where they fit, what else an auditor expects, and how to evidence them.
- [ISO/IEC 27001:2022 compliance: a practical implementation guide](https://support.icompaas.com/compliance/iso-27001-2022): ISO 27001 Annex A.8 (technological controls) is where cloud hardening evidence lands; the guide shows how to run the ISMS around it.
