> For the complete documentation index, see [llms.txt](https://docs.bindplane.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bindplane.com/integrations/sources/pgbouncer.md).

# PgBouncer

The PgBouncer source collects logs from a PgBouncer connection pooler. It tails one or more PgBouncer log files from disk and, optionally, parses each line into structured fields. This source collects logs only; it does not scrape metrics.

### Supported Telemetry

| Platform | Metrics | Logs | Traces |
| -------- | ------- | ---- | ------ |
| Linux    |         | ✓    |        |
| Windows  |         | ✓    |        |
| macOS    |         | ✓    |        |

### Prerequisites

* PgBouncer configured to write to a log file. Set `logfile` in `pgbouncer.ini` to the path the collector will read. See the [PgBouncer configuration reference](https://www.pgbouncer.org/config.html) for the `logfile` and related log settings.
* The collector must run on the same host as PgBouncer (or have read access to the PgBouncer log file by another means).
* The collector process must have read permission on the configured log file path(s).

If PgBouncer is configured to send logs to syslog rather than a file, use a syslog-based source instead; this source reads from log files on disk.

### Configuration

<figure><img src="/files/JApbw4RWEabp6uvnjcQz" alt="Bindplane docs - PgBouncer - image 1"><figcaption></figcaption></figure>

**Logs**

| Parameter | Type    | Required | Default                            | Description                                           |
| --------- | ------- | -------- | ---------------------------------- | ----------------------------------------------------- |
| Log Paths | Strings | No       | `/var/log/pgbouncer/pgbouncer.log` | File paths to PgBouncer logs. Accepts multiple paths. |

**Advanced**

| Parameter | Type                 | Required | Default | Description                                               |
| --------- | -------------------- | -------- | ------- | --------------------------------------------------------- |
| Start At  | Enum: beginning, end | No       | `end`   | Start reading logs from `beginning` or `end` of the file. |
| Parse     | Boolean              | No       | `true`  | Parses the log fields into structured data.               |

### Examples

#### Collect PgBouncer logs from a non-default path

A PgBouncer instance writes its log to `/opt/pgbouncer/logs/pgbouncer.log`. This configuration reads that file, starts at the end so only new lines are collected, and parses each line into structured fields.

```yaml
- name: file_path
  value:
    - /opt/pgbouncer/logs/pgbouncer.log
- name: start_at
  value: end
- name: parse
  value: true
```

### Configuration Tips

* Set **Start At** to `beginning` the first time you want to backfill an existing log file; leave it at `end` to collect only new entries going forward.
* Disable **Parse** if you want to forward the raw log line unmodified, for example when a downstream processor handles parsing.
* Provide multiple paths under **Log Paths** to collect from more than one PgBouncer instance on the same host.

### Troubleshooting

#### No logs are collected

Symptoms: the source is running but no log records arrive.

Solutions:

1. Confirm PgBouncer is configured with a `logfile` and is actively writing to it.
2. Verify the path in **Log Paths** matches the actual log file location and that the collector process has read permission on it.
3. If the file already existed before the source started and you expect historical lines, set **Start At** to `beginning`.

#### Log lines arrive unparsed

Symptoms: records appear but fields are not broken out into structured data.

Solutions:

1. Confirm **Parse** is enabled.
2. Verify the log lines follow the standard PgBouncer log format; non-standard or custom formats may not parse cleanly.

### Standalone Source

```yaml
apiVersion: bindplane.observiq.com/v1
kind: Source
metadata:
  name: pgbouncer
spec:
  type: pgbouncer
  parameters:
    - name: file_path
      value:
        - /var/log/pgbouncer/pgbouncer.log
    - name: start_at
      value: end
    - name: parse
      value: true
```

### Related Resources

* [PgBouncer configuration reference (log settings)](https://www.pgbouncer.org/config.html)
* [filelogreceiver — OpenTelemetry Collector Contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/filelogreceiver)


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.bindplane.com/integrations/sources/pgbouncer.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
