Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Neon 4 min read Case study mediumAdept

How We Export Postgres Logs to Third-Party Services

Neon exports customer Postgres logs by having Postgres write to rsyslogd alongside stderr, with rsyslogd pushing RFC 5424 syslog over TCP to an OpenTelemetry Collector that enriches and forwards them to Datadog or any OTLP-compatible platform. Scraping pods by label wasn't supported by the OTel Collector, and unstructured logs from multiple NeonVM processes made filtering unreliable, so they switched from pull to push. Roadblocks included rsyslogd requiring a restart rather than a config reload, and a k8sattributes bug fixed by a transform step that copies net.peer.ip into k8s.pod.ip for pod matching. The same rsyslogd instance also ships pg_audit logs to secure storage for HIPAA customers.

Related posts

  • How We Export Metrics to Third-Party Services

    Neon mediumAdept

    Neon streams Postgres and host metrics to Datadog, New Relic and any OTLP-compatible platform by running a per-project OpenTelemetry Collector colocated with compute pods in each region. Collectors are provisioned through the OTel Kubernetes Operator via a custom resource. Each one scrapes sql_exporter and Vector endpoints using Kubernetes pod service discovery filtered by project label, then applies memory limiting and batching before exporting. Per-project placement was chosen over per-user or per-org collectors to avoid cross-region scraping latency and to keep failure domains isolated, and the setup reuses the same scraping model as the internal vmagent/VictoriaMetrics monitoring pipeline.

  • Change Data Capture with Serverless Postgres

    Neon mediumAdept

    Neon has released Postgres logical replication in beta, letting Neon databases act as publishers that stream an initial snapshot plus row-level changes to external stores for change data capture and real-time analytics. Under the hood, the walsender decodes the WAL through an output plugin: pgoutput for Postgres-to-Postgres replication, and newly supported wal2json for systems such as Kafka or Materialize. Enabling it is irreversible and restarts the compute. Neon can't act as a subscriber yet, active subscribers can prevent scale-to-zero, DDL changes are not replicated, and replication lag should be monitored.

  • Stream data from Neon to external data sources via logical replication

    Neon mediumAdept

    Neon now supports outbound Postgres logical replication in beta, letting a Neon database publish WAL-decoded inserts, updates and deletes to warehouses, Kafka, CDC tools and other Postgres databases; inbound replication is coming later. Logical replication covers data changes only, not DDL, so schema changes must be applied to subscribers by hand. It uses publications, decoder plugins like pgoutput, and replication slots that retain WAL until subscribers consume it. In Neon, enabling it restarts all computes, only roles created via Console/CLI/API carry the REPLICATION privilege, and inactive slots are dropped after 75 minutes when other active slots exist. Setup guides cover Airbyte, Fivetran, Confluent, Materialize, Decodable, Bemi, DoubleCloud and Sequin.

  • The Difference Between Postgres Logging and PGAudit

    Neon mediumAdept

    Postgres's built-in logging is designed for operational monitoring and troubleshooting, while PGAudit produces structured audit logs for compliance regimes like HIPAA, SOX and PCI DSS. PGAudit supports session auditing by statement class (READ, WRITE, ROLE, DDL, etc.) and object auditing through an audit role, and emits AUDIT:-prefixed entries with session and statement counters. A side-by-side healthcare example shows standard logging writing a CREATE USER password in plaintext where PGAudit redacts it, and PGAudit labeling reads, writes, role switches and permission failures explicitly. The recommendation is to run both, ship audit logs to a SIEM, and set retention policies such as HIPAA's six years.

  • Postgres Meets Analytics: CDC From Neon to ClickHouse Via PeerDB

    Neon mediumAdept

    Neon serverless Postgres can serve as the transactional system of record while ClickHouse handles real-time analytics, with PeerDB streaming changes between them via Postgres logical replication. Setup involves creating a replication-capable user and a publication in Neon, enabling logical replication (wal_level=logical), creating a destination database and a user with insert/alter grants in ClickHouse, then defining peers and a CDC mirror in PeerDB with an initial snapshot and table selection. PeerDB, now owned by ClickHouse, is slated to power the Postgres CDC connector in ClickPipes.

The quest for software engineering knowledge.

Look:
Layout: