Skip to main content
Collect logs from a self-hosted PostgreSQL server β€” errors, slow queries, and connection activity β€” with the OpenTelemetry Collector. The same Collector can also forward traces and metrics from your apps β€” see Connect OpenTelemetry Collector to Bronto.

Prerequisites

  • A Bronto account and API key (how to create one)
  • PostgreSQL writing logs to disk. The default log_directory lives under the data directory; Debian/Ubuntu packages use /var/log/postgresql/
  • An OpenTelemetry Collector (recommended) or Fluent Bit installed on the same host
To capture useful detail, set these in postgresql.conf and reload:
postgresql.conf

Configure the Collector

PostgreSQL entries can span multiple lines (statements, context). Use multiline keyed on the leading timestamp:
/etc/otel/config.yaml
Set <REGION> to eu or us.

What you will see in Bronto

Open Search and filter by service.name = postgresql. Entries include slow-query lines (with duration and statement text), connection and disconnection events, errors, and warnings β€” each prefixed with a timestamp, process ID, and severity. Bronto’s Custom Parser extracts these fields server-side.

Troubleshooting

  • Where are the logs? Run SHOW log_directory; and SHOW log_filename; in psql, or read $PGDATA/current_logfiles. Adjust the include path to match.
  • Want structured fields at the source? On PostgreSQL 15+, set log_destination = 'jsonlog' for JSON log files (*.json) and point include at them for direct field extraction.
  • For general issues, see OTel Collector troubleshooting.

Alternative: Fluent Bit

If you already run Fluent Bit, tail the PostgreSQL log files and forward them over HTTP:
fluent-bit.conf
Set Format to json_lines, not json. For statements that span lines, add a multiline.parser keyed on the leading timestamp. See Connect Fluent Bit to Bronto.