Skip to content

Installation

aharonrobbins edited this page Mar 6, 2017 · 19 revisions

Download

Download the latest binary release from: https://bintray.com/mcafee/postgresql-audit-plugin/release.

Development snapshot builds are available at: https://bintray.com/mcafee/postgresql-audit-plugin/dev-snapshot (follow the latest version link and then the "Files" link). These builds are right off the trunk. They are usually stable, but do have a higher chance of containing new bugs.

Make sure to download the proper binary distribution. There are separate binaries for PostgreSQL 9.2.13, 9.3.0, 9.4.0 and 9.5.0, according to platform (32 or 64 bit). The 9.x.0 binaries are expected to work for all the minor releases.

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