More Info:

The value of log_statement flag determined the SQL statements that are logged. Valid values are: • none • ddl • mod • all The value ddl logs all data definition statements. The value mod logs all ddl statements, plus data-modifying statements. The statements are logged after a basic parsing is done and statement type is determined, thus this does not logs statements with errors. When using extended query protocol, logging occurs after an Execute message is received and values of the Bind parameters are included. A value of ‘ddl’ is recommended unless otherwise directed by your organization’s logging policy.

Risk Level

Low

Address

Reliability, Security

Compliance Standards

CISGCP, CBP

Triage and Remediation

Remediation

To remediate the PostgreSQL Log Statement Flag misconfiguration in GCP using GCP console, please follow the steps below:

  1. Login to your GCP console and select the project where the PostgreSQL instance is located.
  2. In the navigation menu, select SQL under the Storage section.
  3. Select the PostgreSQL instance where the misconfiguration exists.
  4. Click on the Edit button at the top of the page.
  5. Scroll down to the Flags section and look for the log_statement flag.
  6. Set the log_statement flag to one of the following values based on your requirements:
    • none: Disables logging of all statements
    • ddl: Logs only data definition language (DDL) statements
    • mod: Logs only statements that modify data (INSERT, UPDATE, DELETE)
    • all: Logs all statements (default)
  7. Once you have set the log_statement flag appropriately, click on the Save button at the bottom of the page.
  8. Wait for a few minutes for the changes to take effect.

That’s it! You have successfully remediated the PostgreSQL Log Statement Flag misconfiguration in GCP using GCP console.