> 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-14.md).

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

## Rule Details

|                        |                                      |
| ---------------------- | ------------------------------------ |
| Cortex AppSec Rule ID  | APPSEC2\_GCP\_14                     |
| Category - Subcategory | Logging - Disabled or missing        |
| Provider               | GCP                                  |
| Severity               | LOW                                  |
| Framework              | Terraform, Terraform Plan            |
| Mapped CSPM/KSPM Rule  | 2800da7f-6c99-4432-8fe3-555614547005 |

## Impact

This rule is checking to make sure that the 'log\_executor\_stats' flag is set to 'off' for PostgreSQL databases in Google Cloud Platform (GCP). The 'log\_executor\_stats' flag, when enabled, logs information about the performance of the executor stage of query execution in PostgreSQL. While this information can be useful for performance tuning, it can also generate a significant amount of log data, potentially leading to increased storage costs and making important log entries harder to find. Therefore, unless this level of logging is necessary, the rule suggests setting this flag to 'off' to discourage unnecessary logging.

## How to Fix

*Resource:* google\_sql\_database\_instance

* *Arguments:* settings.database\_flags

To fix this issue, you should set the 'log\_executor\_stats' flag value to 'off' for PostgreSQL database instances in your Terraform configuration. Before disabling, understand that this flag can provide useful metrics but may add extra overhead, so it's important to balance your needs accordingly.

\[source,hcl]

```
resource "google_sql_database_instance" "default" {
 project = "my-gcp-project"
 name = "my-database"
 region = "us-central1"

 settings {
 tier = "db-f1-micro"

 database_flags {
 name = "log_executor_stats"
 value = "off"
 }
 }
}
```

The above code block configures a Google Cloud SQL PostgreSQL database instance with the 'log\_executor\_stats' flag set to 'off'. This will ensure that executor-level statistics for each query are not in the database log, thereby meeting the Cortex Cloud AppSec rule requirements, reducing unnecessary overhead, and potentially improving performance.


---

# 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-14.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.
