Control: Ensure 'log_min_error_statement' database flag for Alloy DB instance is set to 'Error' or stricter
Description
The log_min_error_statement flag defines the minimum message severity level that are considered as an error statement. Messages for error statements are logged with the SQL statement. Valid values include DEBUG5, DEBUG4, DEBUG3, DEBUG2, DEBUG1, INFO, NOTICE, WARNING, ERROR, LOG, FATAL, and PANIC. Each severity level includes the subsequent levels mentioned above. Ensure a value of ERROR or stricter is set.
Usage
Run the control in your terminal:
powerpipe control run gcp_compliance.control.alloydb_instance_log_min_error_statement_database_flag_configured
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run gcp_compliance.control.alloydb_instance_log_min_error_statement_database_flag_configured --share
SQL
This control uses a named query:
select self_link resource, case when database_flags is not null and database_flags ? 'log_min_error_statement' then 'ok' else 'alarm' end as status, case when database_flags is not null and database_flags ? 'log_min_error_statement' then title || ' ''log_min_error_statement'' database flag set.' else title || ' ''log_min_error_statement'' database flag not set.' end as reason , location as location, project as projectfrom gcp_alloydb_instance;