> 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/posture-rules/cloud-saas-active-directory-posture-rules/cortex-posture-query-based-rules/detection-rules-by-name/gcp-postgresql-instance-database-flag-log-disconnections-is-disabled.md). Agents can also search and read this documentation through its [MCP server](https://cortex-docs.paloaltonetworks.com/~gitbook/mcp).

# GCP PostgreSQL instance database flag log\_disconnections is disabled

### Synopsis

| Field               | Value                                                                 |
| ------------------- | --------------------------------------------------------------------- |
| Rule Type           | Detection                                                             |
| Finding Type        | GCP PostgreSQL instance database flag log\_disconnections is disabled |
| Finding ID          | 60000414                                                              |
| Generates a Finding | This detection rule also generates a finding                          |
| Severity            | Informational                                                         |
| Category            | CONFIGURATION                                                         |
| Cloud Providers     | GCP                                                                   |
| Platform Module     | CSPM                                                                  |
| Asset Types         | GOOGLE\_CLOUD\_SQL\_DB\_INSTANCE                                      |

### Description

Disabling the `log_disconnections` flag on Google Cloud Platform (GCP) PostgreSQL instances presents a security risk by hindering the detection of unauthorized database access and unusual activity.

The `log_disconnections` flag in PostgreSQL controls logging of database session terminations. Disabling it prevents recording connection closures, making it difficult to identify suspicious login attempts, brute-force attacks, or compromised accounts. Attackers could exploit this lack of logging to maintain persistent access without detection.

A misconfiguration resulting in disabled `log_disconnections` compromises incident response capabilities. Without logs detailing session terminations, identifying the source and extent of a data breach or unauthorized access becomes significantly more challenging, increasing the time to remediation and potential data loss. Enabling this flag provides valuable audit trails for security monitoring and forensic analysis.

To mitigate this risk, enable the `log_disconnections` flag on all GCP PostgreSQL instances. Regularly review the logs for unusual activity, such as frequent disconnections from untrusted IP addresses or failed login attempts. Implement centralized log management for easier monitoring and analysis across all database instances.

### Remediation

1. Login to GCP Console
2. Navigate to SQL
3. Click on the PostgreSQL instance ID for which you want to enable the database flag from the list
4. Click 'Edit'

   NOTE: If the instance is stopped, You need to START instance first to edit the configurations, then Click on EDIT.
5. Go to the 'Flags' section under 'Configuration options'
6. To set a flag that has not been set on the instance before, click 'Add item', choose the flag 'log\_disconnections' from the drop-down menu and set the value as 'on'.
7. If it is already set to 'off' for 'log\_disconnections', from the drop-down menu set the value as 'on'
8. Click on 'Save'


---

# 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/posture-rules/cloud-saas-active-directory-posture-rules/cortex-posture-query-based-rules/detection-rules-by-name/gcp-postgresql-instance-database-flag-log-disconnections-is-disabled.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.
