pgdisablelogerror is a PostgreSQL extension that will disable server logging for specified sql error codes.
This will allow you to omit messages for acceptable errors (for example unique key violations - 23505).
make install USE_PGXS=1
- Build the extension
- Add pgdisablelogerror to "shared_preload_libraries" in postgresql.conf
- Restart PostgreSQL to reload new shared library
- Create extension in postgres database (you only need to create it under postgres database)
postgres=# CREATE EXTENSION pgdisablelogerror;
Comma separated list of sql error codes to skip logging.
Scope: System
Default: ''
Empty or NULL will disable the extension.
Add the following code to log_line_prefix: %e