Skip to content

Installation

William Barrett edited this page Apr 29, 2021 · 19 revisions

Download

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.

Installation

The following assumes your PostgreSQL installation is in something like /usr/psgl-95. Adjust the paths to suit your local setup.

  1. Shut down the database first:

     /etc/init.d/postgresql-9.5 stop
    
  2. 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/
    
  3. Edit the PostgreSQL configuration file, /var/lib/pgsql/9.5/data/postgresql.conf Find the line with shared_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'
  1. 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
  2. Restart the database:

     /etc/init.d/postgresql-9.5 start
    

Configuring the Plugin

See: Configuration

Troubleshooting

See: Troubleshooting

Clone this wiki locally