🛡️ Google Cloud PostgreSQL Instance Log_min_duration_statement Database Flag is not set to -1 (Disabled)🟢
- Contextual name: 🛡️ PostgreSQL Instance Log_min_duration_statement Database Flag is not set to
-1(Disabled)🟢 - ID:
/ce/ca/google/sql/postgresql-instance-log-min-duration-statement-flag - Tags:
- Policy Type:
COMPLIANCE_POLICY - Policy Categories:
SECURITY
Logic
Similar Policies
Description
Description
The
log_min_duration_statementflag defines the minimum amount of execution time of a statement in milliseconds where the total duration of the statement is logged. Ensure thatlog_min_duration_statementis disabled, i.e., a value of-1is set.Rationale
Logging SQL statements may include sensitive information that should not be recorded in logs. This recommendation is applicable to PostgreSQL database instances.
Impact
Turning on logging will increase the required storage over time. Mismanaged logs may cause your storage costs to increase. Setting custom flags via command line on certain instances will cause all omitted flags to be reset to defaults. This may cause you to lose custom flags and could result in unforeseen complications or instance restarts. Because of this, it is recommended you apply these flags changes during a period of low usage.
Audit
From Google Cloud Console
- Go to the Cloud SQL Instances page in the Google Cloud Console by visiting https://console.cloud.google.com/sql/instances.
... see more
Remediation
Remediation
From Google Cloud Console
- Go to the Cloud SQL Instances page in the Google Cloud Console by visiting https://console.cloud.google.com/sql/instances.
- Select the PostgreSQL instance where the database flag needs to be enabled.
- Click
Edit.- Scroll down to the
Flagssection.- To set a flag that has not been set on the instance before, click
Add item, choose the flaglog_min_duration_statementfrom the drop-down menu and set a value of-1.- Click
Save.- Confirm the changes under
Flagson the Overview page.From Google Cloud CLI
List all Cloud SQL database instances using the following command:
gcloud sql instances listConfigure the
log_min_duration_statementflag for every Cloud SQL PosgreSQL database instance using the below command:gcloud sql instances patch <INSTANCE_NAME> --database-flags log_min_duration_statement=-1Note: This command will overwrite all database flags previously set. To keep those and add new ones, include the values for all flags to be set on the instance; any flag not specifically included is set to its default value. For flags that do not take a value, specify the flag name followed by an equals sign ("=").