Collecting data changes from the server log

The following is the easiest way to do auditing, and requires the least amount of setup:

  • Set log_statement to mod or all in the server log
  • Collect all INSERT, UPDATE, DELETE, and TRUNCATE commands from the log

Alternatively, you can do one of the following: just set up a way to store the logs on the database server, copy them to another host, or collect them with a version of syslog that allows you to collect logs on a designated logging server from the start.

Get PostgreSQL Administration Cookbook, 9.5/9.6 Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.