-
Notifications
You must be signed in to change notification settings - Fork 1
Installation
Download the latest binary release from: https://github.com/mcafee/postgresql-audit/releases.
Make sure to download the proper binary distribution. There are separate binaries for PostgreSQL, from versions 9.4.0, 9.5.0, 9.6.0, 10, 11, 12, and 13 according to platform (32 or 64 bit). The 9.x.0 binaries are expected to work for all the minor releases. The binaries for regular PostgreSQL are compatible with EDB PostgreSQL Standard server.
In addition, there are 64 bit binaries for EDB Postgres (Enterprise), supporting versions 9.4, 9.5 and 9.6.
The following assumes your PostgreSQL installation is in something like
/usr/psgl-95
. Adjust the paths to suit your local setup.
-
Shut down the database first:
/etc/init.d/postgresql-9.5 stop
-
Unzip the distribution. Install the files into the database's directory:
cp ./audit.so /usr/pgsql-9.5/lib/audit.so cp ./audit.control /usr/pgsql-9.5/share/extension/ cp ./audit--1.0.sql /usr/pgsql-9.5/share/extension/
-
Edit the PostgreSQL configuration file,
/var/lib/pgsql/9.5/data/postgresql.conf
Find the line withshared_preload_libraries
and change it to read:shared_preload_libraries = 'audit'
If you are already loading libraries, then add 'audit' to the end of the comma-separated list. As an example:
shared_preload_libraries = 'pg_stat_statements,audit'
-
To enable logging:
- To log to a file, add the following line:
audit.json_file = 1
- To log to a Unix domain socket, add the following line:
audit.json_unix_socket = 1
- To log to a file, add the following line:
-
Restart the database:
/etc/init.d/postgresql-9.5 start
See: Configuration
See: Troubleshooting