pgsqlauditengine
pgsqlauditengine · SQL policy checks with an embedded rule and audit REST API
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 101970 | pgsqlauditengine | pgsqlauditengine | 1.0 | SEC | GPL-3.0-only | C |
PostgreSQL · 11, 12, 13, 14, 15, 16, 17, 18
Usage
Sources:
pgsqlauditengine checks SQL policy before execution through PostgreSQL hooks and exposes rules and audit records through an embedded REST service. The documented compatibility range is PostgreSQL 11–18.
Enablement
Add the library to the existing preload list, enable checks, and restart. The unusual spelling of the GUC prefix below is intentional. Configure a nonempty API token before enabling remote access.
Rules and API
The extension DDL registers metadata; preloading activates the hooks. PGSAUDAUDITENGINE.enabled defaults to off. Rules cover DDL, DML, privileges, transaction statements, and programmable objects. Both ERROR and WARNING rule severities block execution; NOTICE allows it.
The API exposes /api/v1/health, /api/v1/rules, /api/v1/audit-logs, and /api/v1/config. Rule changes take effect at runtime. Audit records use a ring buffer rather than a durable audit archive. An empty PGSAUDAUDITENGINE.api_token disables authentication, and the health endpoint is unauthenticated. Keep the service restricted and manage grants/configuration as an administrator.