For the complete documentation index, see llms.txt. This page is also available as Markdown.

PostgreSQL

The PostgreSQL source collects metrics and logs from a PostgreSQL server. Metrics are scraped from PostgreSQL's statistics views over a TCP or Unix connection using a monitoring user. Logs are read from the PostgreSQL log file(s) on disk and optionally parsed into structured fields. Choose Logs, Metrics, or both.

Supported Telemetry Types

Platform
Metrics
Logs
Traces

Linux

Windows

macOS

Prerequisites

For metrics:

  • A reachable PostgreSQL endpoint (host and port, default localhost:5432), or a Unix socket if transport is set to unix. The collector host must have network access to the PostgreSQL port.

  • A monitoring user with read-only access to PostgreSQL's statistics views. On PostgreSQL 10 and later, grant the built-in pg_monitor role to a dedicated, least-privilege user rather than using a superuser account. The pg_monitor role bundles read access to the pg_stat_* views and configuration settings the receiver queries. See Predefined Roles in the PostgreSQL documentation.

  • TLS material (CA certificate, and a client certificate and key for mutual TLS) if you enable TLS for the metrics connection.

For logs:

  • PostgreSQL configured to write its logs to disk, and the path(s) to the log file(s). Defaults cover common Debian/Ubuntu, SLES, and CentOS/RHEL locations.

  • The collector must have read access to the log file(s).

Configuration

Bindplane docs - PostgreSQL - image 1

General

Parameter
Type
Required
Default
Description

Choose Telemetry Type

Telemetry Selector

No

["Logs", "Metrics"]

Which signals this source collects. Valid values: Logs, Metrics.

Metrics

Parameter
Type
Required
Default
Description

Endpoint

String

No

localhost:5432

Endpoint of the PostgreSQL server. If Transport is set to unix, the endpoint is translated from host:port to /host.s.PGSQL.port.

Transport

Enum: tcp, unix

No

tcp

The transport protocol used to connect to PostgreSQL.

Username

String

Yes

(empty)

Username used to authenticate.

Password

String

Yes

(empty)

Password used to authenticate. Stored as a sensitive value.

Logs

Parameter
Type
Required
Default
Description

Log Paths

Strings

No

See below

Path to PostgreSQL log file(s). Defaults: /var/log/postgresql/postgresql*.log (Debian/Ubuntu), /var/lib/pgsql/data/log/postgresql*.log (SLES), /var/lib/pgsql/*/data/log/postgresql*.log (CentOS/RHEL). Advanced.

Start At

Enum: beginning, end

No

end

Start reading logs from beginning or end. Advanced.

Parse

Boolean

No

true

Parses the log fields into structured data. Advanced.

Advanced

Parameter
Type
Required
Default
Description

Databases

Strings

No

(empty)

The list of databases for which the receiver collects statistics. An empty list collects statistics for all databases. Metrics only.

Collection Interval

Integer

No

60

How often (in seconds) to scrape for metrics. Metrics only.

Enable TLS

Boolean

No

false

Whether to use TLS for the metrics connection. Metrics only.

TLS Certificate Authority File

String

No

(empty)

Certificate authority used to validate TLS certificates. Relevant when Enable TLS is true.

TLS Client Certificate File

String

No

(empty)

A TLS certificate used for client authentication, if mutual TLS is enabled. Relevant when Enable TLS is true.

TLS Client Private Key File

String

No

(empty)

A TLS private key used for client authentication, if mutual TLS is enabled. Relevant when Enable TLS is true.

Skip TLS Certificate Verification

Boolean

No

false

Skip TLS certificate verification. Relevant when Enable TLS is true.

Metrics

Metrics

No

(empty)

Toggle individual metrics on or off. Metrics only.

Examples

Collect metrics and logs from a local PostgreSQL server

This source scrapes metrics from PostgreSQL on localhost:5432 using a monitoring user and tails the default Debian/Ubuntu log path.

Scrape a single database over TLS

This source collects metrics for only the app database over a TLS connection.

Configuration Tips

  • Grant the dedicated monitoring user the pg_monitor role instead of using a superuser. It provides exactly the read access the receiver needs to the pg_stat_* views.

  • Leave Databases empty to collect statistics for all databases, or list specific database names to narrow the scope.

  • Logs and metrics use independent connection paths: metrics connect to the PostgreSQL endpoint, while logs are read directly from the log file(s) on the collector host. Enabling one does not require the other.

Troubleshooting

Connection refused on metrics

Symptoms: the metrics receiver cannot reach the PostgreSQL server.

Solutions:

  1. Confirm the Endpoint host and port are correct and that PostgreSQL is listening (check listen_addresses in postgresql.conf).

  2. Verify the collector host can reach the port through any firewall or security group, and that pg_hba.conf allows the connecting host.

Authentication failed

Symptoms: the receiver connects but cannot authenticate or read statistics.

Solutions:

  1. Verify the Username and Password are correct for the monitoring user.

  2. Confirm the user has been granted the pg_monitor role (or the equivalent SELECT grants on the pg_stat_* views on PostgreSQL versions earlier than 10).

No logs are collected

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

Solutions:

  1. Confirm PostgreSQL is writing logs to disk and that the Log Paths match the actual file location.

  2. Verify the collector process has read permission on the log file(s) and parent directories.

Standalone Source

Last updated

Was this helpful?