---
title: "The Difference Between Postgres Logging and PGAudit"
description: "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."
url: "https://swe.quest/articles/the-difference-between-postgres-logging-and-pgaudit-3a35dae235b4a4b7"
canonical: "https://neon.com/blog/postgres-logging-vs-pgaudit"
source: "Neon"
published: "2025-05-28"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 8
tags: ["postgres","privacy","security","observability"]
---

# The Difference Between Postgres Logging and PGAudit

A post on [Neon](https://swe.quest/sources/neon.md), published 2025-05-28, 8 min read, Deep dive. Original: [https://neon.com/blog/postgres-logging-vs-pgaudit](https://neon.com/blog/postgres-logging-vs-pgaudit)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Privacy](https://swe.quest/tags/privacy.md) (Security)
- [Security](https://swe.quest/tags/security.md) (Security)
- [Observability](https://swe.quest/tags/observability.md) (Reliability & operations)

## Prerequisites

- PostgreSQL configuration ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- SQL roles and privileges ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))

## Keywords

PGAudit, PostgreSQL, HIPAA, Neon, SIEM

## Related posts

- [How We Export Postgres Logs to Third-Party Services](https://swe.quest/articles/how-we-export-postgres-logs-to-third-party-services-bed5372bbc749f83.md): Neon · 2025-06-24 · Medium · 4 min read · Observability, PostgreSQL, Kubernetes
  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.
- [Postgres Auditing in 150 lines of SQL](https://swe.quest/articles/postgres-auditing-in-150-lines-of-sql-856d18202de453da.md): Supabase · 2022-03-08 · Medium · 7 min read · PostgreSQL, SQL, Databases
  A generic table-auditing system can be built inside PostgreSQL with about 150 lines of SQL: a single append-only audit.record\_version table stores each row's old and new contents as JSONB, populated by a per-row trigger enabled via audit.enable\_tracking().
- [How Seemplicity scaled real-time security analytics with Postgres CDC and ClickHouse](https://swe.quest/articles/how-seemplicity-scaled-real-time-security-analytics-with-postgres-cdc-and-c80fc0ac79e77c01.md): ClickHouse · 2025-05-29 · Easy · 6 min read · Event-driven architecture, Analytics & OLAP, PostgreSQL, Multi-tenancy, Data pipelines
  Seemplicity, a security remediation platform aggregating findings from 150+ tools, outgrew a Postgres-only design as heavy upserts, table bloat and multi-table joins across ~16 per-tenant tables slowed customer dashboards.
- [How to Keep Staging in Sync with Production in Postgres](https://swe.quest/articles/how-to-keep-staging-in-sync-with-production-in-postgres-2a3ed8d4d274df22.md): Neon · 2025-12-23 · Medium · 5 min read · PostgreSQL, Replication, Privacy, Testing
  Postgres staging environments drift from production, and the traditional fixes each fall short. pg\_dump/pg\_restore gives a clean copy but takes staging offline and runs for hours on large databases.
- [Security Disclosure Recommendation: Rotate PostgreSQL Database Credentials](https://swe.quest/articles/security-disclosure-recommendation-rotate-postgresql-database-credentials-101ad2e32389050e.md): Railway · 2026-10-22 · Medium · 4 min read · PostgreSQL, Security, Identity & auth, Incidents & postmortems
  After Railway's October 21, 2026 security disclosure, PostgreSQL users on the Railway template should regenerate the database password from the Database View, which changes it inside PostgreSQL and updates POSTGRES\_PASSWORD and the variables that reference it in one step.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
