Join more than 25k Postgres enthusiasts and sign up for our newsletter!

Log Insights: Kubernetes with OpenTelemetry

If you are running the database in a Kubernetes cluster, you can use the db_log_otel_server setting to have the collector listen for OpenTelemetry log data model messages. When this is specified, the collector will run an HTTP server behind the scenes on the specified port to receive logs at the /v1/logs endpoint. This should be a local address like 0.0.0.0:4318 and it's recommended to use an unprivileged port number (1024 and up) to avoid running the HTTP server as root.

Note: This currently only supports CloudNativePG PostgreSQL logs.

Using with a pganalyze collector Helm chart

If you are deploying the pganalyze collector using a Helm chart, you can update the values.yaml file to create a service for this HTTP server. In values.yaml file, update the section of service:

service:
  create: true
  name: pganalyze-collector-otel-service
  type: ClusterIP
  port: 4318
  targetPort: 4318

This will create a service with the name pganalyze-collector-otel-service. Assuming you use Fluent Bit as a telemetry agent, you can specify the created service as an OpenTelemetry HTTP endpoint, using the OpenTelemetry output plugin:

  [OUTPUT]
    name  opentelemetry
    match kube.*postgres*
    host  pganalyze-collector-otel-service
    port  4318

With this flow, Fluent Bit tails the logs of Postgres pods, sends the logs to the pganalyze collector's OpenTelemetry HTTP endpoint (via pganalyze-collector-otel-service), and the collector processes the logs.


Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →