---
title: >-
  PostgreSQL instances should have the 'log_min_messages' database flag set to
  at least 'WARNING'
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > OOTB Rules > PostgreSQL instances should have the
  'log_min_messages' database flag set to at least 'WARNING'
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# PostgreSQL instances should have the 'log_min_messages' database flag set to at least 'WARNING'
 
## Description{% #description %}

This rule fails when a Cloud SQL for PostgreSQL instance sets the `log_min_messages` flag to a level below `WARNING` (`DEBUG5` to `DEBUG1`, `INFO`, or `NOTICE`), to a value that is not a Cloud SQL level, or without a value. `log_min_messages` sets the minimum severity of messages written to the server log, and `WARNING`, `ERROR`, `LOG`, `FATAL`, and `PANIC` pass. The CIS benchmark considers `ERROR` the best practice, and higher levels log fewer messages, so choose the level that fits your organization's logging policy.

An instance that does not set the flag passes, because Cloud SQL uses `WARNING` by default. Values are compared case-insensitively. Instances running other database engines are skipped, and an instance with a missing or unspecified database version fails because its engine cannot be determined. A database flag with no name also fails, because it could be `log_min_messages`.

## Remediation{% #remediation %}

Set the `log_min_messages` flag to `WARNING` or a higher level on the flagged instance, or remove the flag, by following [Configure database flags](https://docs.cloud.google.com/sql/docs/postgres/flags).

## References{% #references %}

- [PostgreSQL log_min_messages](https://www.postgresql.org/docs/current/runtime-config-logging.html#GUC-LOG-MIN-MESSAGES)
- [CIS Google Cloud Platform Foundation Benchmark](https://www.cisecurity.org/benchmark/google_cloud_computing_platform)
