Skip to content
pgauditlogtofile

pgauditlogtofile

pgauditlogtofile : pgAudit addon to redirect audit log to an independent file

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
7120
pgauditlogtofile
pgauditlogtofile
1.8.3
SEC
PostgreSQL
C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--sLd-r
No
Yes
Yes
Yes
yes
no
Relationships
See Also
pgaudit
pg_auth_mon
logerrors
pg_permissions
login_hook
set_user
pg_drop_events
table_log

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
PGDG
1.8.3
18
17
16
15
14
pgauditlogtofile-
RPM
PGDG
1.8.3
18
17
16
15
14
pgauditlogtofile_$v-
DEB
PGDG
1.8.3
18
17
16
15
14
postgresql-$v-pgauditlogtofile-
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
el8.aarch64
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
el9.x86_64
PGDG 1.8.3
PGDG 1.8.3
PGDG 1.8.3
PGDG 1.8.3
PGDG 1.8.3
el9.aarch64
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
el10.x86_64
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
el10.aarch64
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
d12.x86_64
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
d12.aarch64
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
d13.x86_64
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
d13.aarch64
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
u22.x86_64
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
u22.aarch64
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
u24.x86_64
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
u24.aarch64
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
u26.x86_64
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
u26.aarch64
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PGDG 1.8.4
PackageVersionOSORGSIZEFile URL
pgauditlogtofile_181.8.4el8.x86_64pgdg33.3 KiBpgauditlogtofile_18-1.8.4-1PGDG.rhel8.10.x86_64.rpm
pgauditlogtofile_181.8.3el8.x86_64pgdg32.6 KiBpgauditlogtofile_18-1.8.3-1PGDG.rhel8.10.x86_64.rpm
pgauditlogtofile_181.8.2el8.x86_64pgdg32.6 KiBpgauditlogtofile_18-1.8.2-1PGDG.rhel8.10.x86_64.rpm
pgauditlogtofile_181.8.1el8.x86_64pgdg30.0 KiBpgauditlogtofile_18-1.8.1-1PGDG.rhel8.10.x86_64.rpm
pgauditlogtofile_181.8.0el8.x86_64pgdg30.0 KiBpgauditlogtofile_18-1.8.0-1PGDG.rhel8.10.x86_64.rpm
pgauditlogtofile_181.7.7el8.x86_64pgdg27.5 KiBpgauditlogtofile_18-1.7.7-2PGDG.rhel8.10.x86_64.rpm
pgauditlogtofile_181.7.6el8.x86_64pgdg27.0 KiBpgauditlogtofile_18-1.7.6-2PGDG.rhel8.x86_64.rpm
pgauditlogtofile_181.7.5el8.x86_64pgdg26.8 KiBpgauditlogtofile_18-1.7.5-1PGDG.rhel8.x86_64.rpm
pgauditlogtofile_181.7.4el8.x86_64pgdg26.6 KiBpgauditlogtofile_18-1.7.4-1PGDG.rhel8.x86_64.rpm
pgauditlogtofile_181.8.4el8.aarch64pgdg32.9 KiBpgauditlogtofile_18-1.8.4-1PGDG.rhel8.10.aarch64.rpm
pgauditlogtofile_181.8.3el8.aarch64pgdg32.3 KiBpgauditlogtofile_18-1.8.3-1PGDG.rhel8.10.aarch64.rpm
pgauditlogtofile_181.8.2el8.aarch64pgdg32.2 KiBpgauditlogtofile_18-1.8.2-1PGDG.rhel8.10.aarch64.rpm
pgauditlogtofile_181.8.1el8.aarch64pgdg29.6 KiBpgauditlogtofile_18-1.8.1-1PGDG.rhel8.10.aarch64.rpm
pgauditlogtofile_181.8.0el8.aarch64pgdg29.6 KiBpgauditlogtofile_18-1.8.0-1PGDG.rhel8.10.aarch64.rpm
pgauditlogtofile_181.7.7el8.aarch64pgdg27.1 KiBpgauditlogtofile_18-1.7.7-2PGDG.rhel8.10.aarch64.rpm
pgauditlogtofile_181.7.6el8.aarch64pgdg26.6 KiBpgauditlogtofile_18-1.7.6-2PGDG.rhel8.aarch64.rpm
pgauditlogtofile_181.7.5el8.aarch64pgdg26.4 KiBpgauditlogtofile_18-1.7.5-1PGDG.rhel8.aarch64.rpm
pgauditlogtofile_181.7.4el8.aarch64pgdg26.2 KiBpgauditlogtofile_18-1.7.4-1PGDG.rhel8.aarch64.rpm
pgauditlogtofile_181.8.3el9.x86_64pgdg30.9 KiBpgauditlogtofile_18-1.8.3-1PGDG.rhel9.7.x86_64.rpm
pgauditlogtofile_181.8.2el9.x86_64pgdg30.7 KiBpgauditlogtofile_18-1.8.2-1PGDG.rhel9.7.x86_64.rpm
pgauditlogtofile_181.8.1el9.x86_64pgdg28.3 KiBpgauditlogtofile_18-1.8.1-1PGDG.rhel9.7.x86_64.rpm
pgauditlogtofile_181.8.0el9.x86_64pgdg28.1 KiBpgauditlogtofile_18-1.8.0-1PGDG.rhel9.7.x86_64.rpm
pgauditlogtofile_181.7.7el9.x86_64pgdg26.2 KiBpgauditlogtofile_18-1.7.7-2PGDG.rhel9.7.x86_64.rpm
pgauditlogtofile_181.7.6el9.x86_64pgdg25.8 KiBpgauditlogtofile_18-1.7.6-2PGDG.rhel9.x86_64.rpm
pgauditlogtofile_181.7.5el9.x86_64pgdg25.5 KiBpgauditlogtofile_18-1.7.5-1PGDG.rhel9.x86_64.rpm
pgauditlogtofile_181.7.3el9.x86_64pgdg25.1 KiBpgauditlogtofile_18-1.7.3-2PGDG.rhel9.x86_64.rpm
pgauditlogtofile_181.7.3el9.x86_64pgdg25.0 KiBpgauditlogtofile_18-1.7.3-1PGDG.rhel9.x86_64.rpm
pgauditlogtofile_181.8.4el9.aarch64pgdg31.1 KiBpgauditlogtofile_18-1.8.4-1PGDG.rhel9.7.aarch64.rpm
pgauditlogtofile_181.8.3el9.aarch64pgdg30.6 KiBpgauditlogtofile_18-1.8.3-1PGDG.rhel9.7.aarch64.rpm
pgauditlogtofile_181.8.2el9.aarch64pgdg30.7 KiBpgauditlogtofile_18-1.8.2-1PGDG.rhel9.7.aarch64.rpm
pgauditlogtofile_181.8.1el9.aarch64pgdg28.1 KiBpgauditlogtofile_18-1.8.1-1PGDG.rhel9.7.aarch64.rpm
pgauditlogtofile_181.8.0el9.aarch64pgdg28.0 KiBpgauditlogtofile_18-1.8.0-1PGDG.rhel9.7.aarch64.rpm
pgauditlogtofile_181.7.7el9.aarch64pgdg25.9 KiBpgauditlogtofile_18-1.7.7-2PGDG.rhel9.7.aarch64.rpm
pgauditlogtofile_181.7.6el9.aarch64pgdg25.4 KiBpgauditlogtofile_18-1.7.6-2PGDG.rhel9.aarch64.rpm
pgauditlogtofile_181.7.5el9.aarch64pgdg25.1 KiBpgauditlogtofile_18-1.7.5-1PGDG.rhel9.aarch64.rpm
pgauditlogtofile_181.7.3el9.aarch64pgdg24.8 KiBpgauditlogtofile_18-1.7.3-2PGDG.rhel9.aarch64.rpm
pgauditlogtofile_181.7.3el9.aarch64pgdg24.7 KiBpgauditlogtofile_18-1.7.3-1PGDG.rhel9.aarch64.rpm
pgauditlogtofile_181.8.4el10.x86_64pgdg31.6 KiBpgauditlogtofile_18-1.8.4-1PGDG.rhel10.1.x86_64.rpm
pgauditlogtofile_181.8.3el10.x86_64pgdg31.0 KiBpgauditlogtofile_18-1.8.3-1PGDG.rhel10.1.x86_64.rpm
pgauditlogtofile_181.8.2el10.x86_64pgdg31.0 KiBpgauditlogtofile_18-1.8.2-1PGDG.rhel10.1.x86_64.rpm
pgauditlogtofile_181.8.1el10.x86_64pgdg28.4 KiBpgauditlogtofile_18-1.8.1-1PGDG.rhel10.1.x86_64.rpm
pgauditlogtofile_181.8.0el10.x86_64pgdg28.2 KiBpgauditlogtofile_18-1.8.0-1PGDG.rhel10.1.x86_64.rpm
pgauditlogtofile_181.7.7el10.x86_64pgdg26.3 KiBpgauditlogtofile_18-1.7.7-2PGDG.rhel10.1.x86_64.rpm
pgauditlogtofile_181.7.6el10.x86_64pgdg26.1 KiBpgauditlogtofile_18-1.7.6-2PGDG.rhel10.x86_64.rpm
pgauditlogtofile_181.7.5el10.x86_64pgdg25.8 KiBpgauditlogtofile_18-1.7.5-1PGDG.rhel10.x86_64.rpm
pgauditlogtofile_181.7.3el10.x86_64pgdg25.5 KiBpgauditlogtofile_18-1.7.3-2PGDG.rhel10.x86_64.rpm
pgauditlogtofile_181.7.3el10.x86_64pgdg25.4 KiBpgauditlogtofile_18-1.7.3-1PGDG.rhel10.x86_64.rpm
pgauditlogtofile_181.8.4el10.aarch64pgdg31.5 KiBpgauditlogtofile_18-1.8.4-1PGDG.rhel10.1.aarch64.rpm
pgauditlogtofile_181.8.3el10.aarch64pgdg30.8 KiBpgauditlogtofile_18-1.8.3-1PGDG.rhel10.1.aarch64.rpm
pgauditlogtofile_181.8.2el10.aarch64pgdg31.0 KiBpgauditlogtofile_18-1.8.2-1PGDG.rhel10.1.aarch64.rpm
pgauditlogtofile_181.8.1el10.aarch64pgdg28.4 KiBpgauditlogtofile_18-1.8.1-1PGDG.rhel10.1.aarch64.rpm
pgauditlogtofile_181.8.0el10.aarch64pgdg28.3 KiBpgauditlogtofile_18-1.8.0-1PGDG.rhel10.1.aarch64.rpm
pgauditlogtofile_181.7.7el10.aarch64pgdg26.3 KiBpgauditlogtofile_18-1.7.7-2PGDG.rhel10.1.aarch64.rpm
pgauditlogtofile_181.7.6el10.aarch64pgdg26.1 KiBpgauditlogtofile_18-1.7.6-2PGDG.rhel10.aarch64.rpm
pgauditlogtofile_181.7.5el10.aarch64pgdg25.8 KiBpgauditlogtofile_18-1.7.5-1PGDG.rhel10.aarch64.rpm
pgauditlogtofile_181.7.3el10.aarch64pgdg25.4 KiBpgauditlogtofile_18-1.7.3-2PGDG.rhel10.aarch64.rpm
pgauditlogtofile_181.7.3el10.aarch64pgdg25.3 KiBpgauditlogtofile_18-1.7.3-1PGDG.rhel10.aarch64.rpm
postgresql-18-pgauditlogtofile1.8.4d12.x86_64pgdg66.9 KiBpostgresql-18-pgauditlogtofile_1.8.4-1.pgdg12+1_amd64.deb
postgresql-18-pgauditlogtofile1.8.3d12.x86_64pgdg65.4 KiBpostgresql-18-pgauditlogtofile_1.8.3-1.pgdg12+1_amd64.deb
postgresql-18-pgauditlogtofile1.8.0d12.x86_64pgdg58.8 KiBpostgresql-18-pgauditlogtofile_1.8.0-1.pgdg12+1_amd64.deb
postgresql-18-pgauditlogtofile1.8.4d12.aarch64pgdg65.6 KiBpostgresql-18-pgauditlogtofile_1.8.4-1.pgdg12+1_arm64.deb
postgresql-18-pgauditlogtofile1.8.3d12.aarch64pgdg64.4 KiBpostgresql-18-pgauditlogtofile_1.8.3-1.pgdg12+1_arm64.deb
postgresql-18-pgauditlogtofile1.8.0d12.aarch64pgdg57.8 KiBpostgresql-18-pgauditlogtofile_1.8.0-1.pgdg12+1_arm64.deb
postgresql-18-pgauditlogtofile1.8.4d13.x86_64pgdg67.3 KiBpostgresql-18-pgauditlogtofile_1.8.4-1.pgdg13+1_amd64.deb
postgresql-18-pgauditlogtofile1.8.3d13.x86_64pgdg65.9 KiBpostgresql-18-pgauditlogtofile_1.8.3-1.pgdg13+1_amd64.deb
postgresql-18-pgauditlogtofile1.8.0d13.x86_64pgdg58.9 KiBpostgresql-18-pgauditlogtofile_1.8.0-1.pgdg13+1_amd64.deb
postgresql-18-pgauditlogtofile1.8.4d13.aarch64pgdg66.2 KiBpostgresql-18-pgauditlogtofile_1.8.4-1.pgdg13+1_arm64.deb
postgresql-18-pgauditlogtofile1.8.3d13.aarch64pgdg64.9 KiBpostgresql-18-pgauditlogtofile_1.8.3-1.pgdg13+1_arm64.deb
postgresql-18-pgauditlogtofile1.8.0d13.aarch64pgdg58.1 KiBpostgresql-18-pgauditlogtofile_1.8.0-1.pgdg13+1_arm64.deb
postgresql-18-pgauditlogtofile1.8.4u22.x86_64pgdg67.5 KiBpostgresql-18-pgauditlogtofile_1.8.4-1.pgdg22.04+1_amd64.deb
postgresql-18-pgauditlogtofile1.8.3u22.x86_64pgdg66.2 KiBpostgresql-18-pgauditlogtofile_1.8.3-1.pgdg22.04+1_amd64.deb
postgresql-18-pgauditlogtofile1.8.0u22.x86_64pgdg59.5 KiBpostgresql-18-pgauditlogtofile_1.8.0-1.pgdg22.04+1_amd64.deb
postgresql-18-pgauditlogtofile1.8.4u22.aarch64pgdg65.8 KiBpostgresql-18-pgauditlogtofile_1.8.4-1.pgdg22.04+1_arm64.deb
postgresql-18-pgauditlogtofile1.8.3u22.aarch64pgdg64.6 KiBpostgresql-18-pgauditlogtofile_1.8.3-1.pgdg22.04+1_arm64.deb
postgresql-18-pgauditlogtofile1.8.0u22.aarch64pgdg58.5 KiBpostgresql-18-pgauditlogtofile_1.8.0-1.pgdg22.04+1_arm64.deb
postgresql-18-pgauditlogtofile1.8.4u24.x86_64pgdg66.2 KiBpostgresql-18-pgauditlogtofile_1.8.4-1.pgdg24.04+1_amd64.deb
postgresql-18-pgauditlogtofile1.8.3u24.x86_64pgdg65.0 KiBpostgresql-18-pgauditlogtofile_1.8.3-1.pgdg24.04+1_amd64.deb
postgresql-18-pgauditlogtofile1.8.0u24.x86_64pgdg58.2 KiBpostgresql-18-pgauditlogtofile_1.8.0-1.pgdg24.04+1_amd64.deb
postgresql-18-pgauditlogtofile1.8.4u24.aarch64pgdg64.8 KiBpostgresql-18-pgauditlogtofile_1.8.4-1.pgdg24.04+1_arm64.deb
postgresql-18-pgauditlogtofile1.8.3u24.aarch64pgdg63.6 KiBpostgresql-18-pgauditlogtofile_1.8.3-1.pgdg24.04+1_arm64.deb
postgresql-18-pgauditlogtofile1.8.0u24.aarch64pgdg57.1 KiBpostgresql-18-pgauditlogtofile_1.8.0-1.pgdg24.04+1_arm64.deb
postgresql-18-pgauditlogtofile1.8.4u26.x86_64pgdg65.6 KiBpostgresql-18-pgauditlogtofile_1.8.4-1.pgdg26.04+1_amd64.deb
postgresql-18-pgauditlogtofile1.8.3u26.x86_64pgdg64.4 KiBpostgresql-18-pgauditlogtofile_1.8.3-1.pgdg26.04+1_amd64.deb
postgresql-18-pgauditlogtofile1.8.0u26.x86_64pgdg57.8 KiBpostgresql-18-pgauditlogtofile_1.8.0-1.pgdg26.04+1_amd64.deb
postgresql-18-pgauditlogtofile1.8.4u26.aarch64pgdg64.2 KiBpostgresql-18-pgauditlogtofile_1.8.4-1.pgdg26.04+1_arm64.deb
postgresql-18-pgauditlogtofile1.8.3u26.aarch64pgdg63.2 KiBpostgresql-18-pgauditlogtofile_1.8.3-1.pgdg26.04+1_arm64.deb
postgresql-18-pgauditlogtofile1.8.0u26.aarch64pgdg57.0 KiBpostgresql-18-pgauditlogtofile_1.8.0-1.pgdg26.04+1_arm64.deb

Source

Install

Make sure PGDG repo available:

pig repo add pgdg -u    # add pgdg repo and update cache

Install this extension with pig:

pig install pgauditlogtofile;		# install via package name, for the active PG version

pig install pgauditlogtofile -v 18;   # install for PG 18
pig install pgauditlogtofile -v 17;   # install for PG 17
pig install pgauditlogtofile -v 16;   # install for PG 16
pig install pgauditlogtofile -v 15;   # install for PG 15
pig install pgauditlogtofile -v 14;   # install for PG 14

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'pgauditlogtofile';

Create this extension with:

CREATE EXTENSION pgauditlogtofile;

Usage

pgauditlogtofile: Redirect pgAudit logs to an independent file

pgauditlogtofile is an addon to pgAudit that redirects audit log lines to a separate file instead of the PostgreSQL server log, with automatic rotation support.

CREATE EXTENSION pgauditlogtofile;

Configuration Parameters

ParameterDefaultDescription
pgaudit.log_formatcsvOutput format: csv or json
pgaudit.log_directorylogDirectory for audit files (empty disables)
pgaudit.log_filenameaudit-%Y%m%d_%H%M.logFilename pattern (supports time patterns)
pgaudit.log_file_mode0600File permissions for audit logs
pgaudit.log_rotation_age1440Rotation interval in minutes (1 day)
pgaudit.log_connectionsoffLog connection events (requires log_connections = on)
pgaudit.log_disconnectionsoffLog disconnection events (requires log_disconnections = on)
pgaudit.log_autoclose_minutes0Auto-close file handler after N minutes of inactivity
pgaudit.log_execution_timeoffMeasure statement execution time
pgaudit.log_execution_memoryoffMeasure memory footprint of statements

Setup

Add to postgresql.conf:

shared_preload_libraries = 'pgaudit, pgauditlogtofile'
pgaudit.log_directory = 'log'
pgaudit.log_filename = 'audit-%Y%m%d_%H%M.log'
pgaudit.log_rotation_age = 1440

Audit entries are written to the separate file while server logs remain clean.

Last updated on