> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/logging/appsec2-gcp-16.md).

# GCP PostgreSQL instance database flag log\_planner\_stats is not set to off misconfiguration detected

## Rule Details

|                        |                                      |
| ---------------------- | ------------------------------------ |
| Cortex AppSec Rule ID  | APPSEC2\_GCP\_16                     |
| Category - Subcategory | Logging - Disabled or missing        |
| Provider               | GCP                                  |
| Severity               | LOW                                  |
| Framework              | Terraform, Terraform Plan            |
| Mapped CSPM/KSPM Rule  | 95268e4e-964b-48ab-99b4-3299071e84a0 |

## Impact

This rule is checking to ensure that the 'log\_planner\_stats' flag for PostgreSQL databases is set to 'off'. The 'log\_planner\_stats' flag is used to enable or disable logging of planner statistics in PostgreSQL. While logging these statistics might be useful for debugging or optimizing purposes, they could potentially contain sensitive information. Furthermore, having this flag set to 'on' could impact the performance of your database due to the overhead of logging. Therefore, it is generally recommended to have this flag set 'off' in a production environment to maintain security and optimal performance.

## How to Fix

*Terraform*

* *Resource:* google\_sql\_database\_instance
* *Arguments:* settings.database\_flags

To fix this issue, you need to add the 'log\_planner\_stats' setting within settings block in the database instance and set it to 'off'. This statement is an example of how you can define a database\_instance:

```hcl
resource "google_sql_database_instance" "default" {
 name = "test"
 region = "us-central1"

 # ...

 database_version = "POSTGRES_9_6"

 settings {
 database_flags {
 name = "log_planner_stats"
 value = "off"
 }

 # ...
 }
}
```

This code is secure because setting the 'log\_planner\_stats' to 'off' ensures that the planner's statistical data is not logged. This helps maintain the security of our database as it may prevent the accidental logging and exposure of sensitive data.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/logging/appsec2-gcp-16.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
