Using error codes to filter audit logs v17

EDB Postgres Advanced Server includes an extension that you can use to exclude from the EDB Postgres Advanced Server log files entries that include a user-specified error code. To filter audit log entries, you must first enable the extension by modifying the postgresql.conf file. Add the following value to those specified in the shared_preload_libraries parameter:

$libdir/edb_filter_log

Then, use the edb_filter_log.errcodes parameter to specify any error codes you want to omit from the log files:

edb_filter_log.errcode = 'error_code'

Where error_code specifies one or more error codes that you want to omit from the log file. Provide multiple error codes in a comma-delimited list.

For example, if edb_filter_log is enabled, and edb_filter_log.errcode is set to '23505,23502,22012', any log entries that return one of the following SQLSTATE errors are omitted from the log file:

  • 23505 (for violating a unique constraint)

  • 23502 (for violating a not-null constraint)

  • 22012 (for dividing by zero)

For a complete list of the error codes supported by EDB Postgres Advanced Server audit log filtering, see the Postgres core documentation.