// the find
fmbiete/pgauditlogtofile
pgAudit Log to File is an addon for pgAudit to redirect audit logs to an independent file
A PostgreSQL C extension that intercepts pgAudit's output and writes it to a separate file instead of the server log, with time-based rotation, optional compression, and execution time/memory tracking. Aimed at DBAs and security teams who need audit trails that don't pollute server logs and can be rotated independently. Actively maintained with a recent commit.
File handles are held per-backend, so audit writes never contend with server logging infrastructure — this is the right architecture for high-throughput systems. The compression benchmark data is honest and shows lz4 is effectively free, which is useful information for capacity planning. The FOREIGN TABLE schema for querying CSV logs directly from Postgres is a genuinely practical touch. The migration path through eight sequential SQL upgrade scripts means you can track schema evolution and upgrade in-place without data loss.
23 stars for a security-focused extension that's been around long enough to have eight upgrade scripts suggests very low adoption — you're likely to be the only person who hits your edge case. The SIGUSR1 behavior to close file handles is not something you'll find in standard Postgres runbooks; operators unfamiliar with it will leak open file descriptors until they read the README. The autoclose feature is marked experimental and uses a background thread inside a backend, which is unusual for Postgres extensions and could interact badly with certain process models. No mention of how audit file integrity is protected — a rogue superuser can trivially truncate or delete the file, so this won't pass a serious compliance audit on its own.