Skip to content

Logging handler for forwarding PostgreSQL log messages to network.

License

Notifications You must be signed in to change notification settings

postsql/pg_logforward

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

41 Commits

Repository files navigation

Introduction ============ pg_logforward is a custom logging handler for PostgreSQL. It intercepts all PostgreSQL log messages by hooking into EmitErrorReport() function in the backend. The intercepted log messages are forwarded via UDP to a remote location. Requires PostgreSQL logging hooks patch - included in the patches directory. The patch is against 9.2devel but also applies against 9.1 and 8.3. Although some offsets are expected. Building ======== USE_PGXS=1 make install Output formats ============== The current version supports JSON, netstring and Syslog output formats. Usage ===== Modify postgresql.conf to include: shared_preload_libraries = 'pg_logforward' # requires restart custom_variable_classes = 'logforward' # deprecated in 9.2 logforward.target_names = 'syslog,jsonsrv,netstr' logforward.syslog_host = '127.0.0.1' logforward.syslog_port = 23456 logforward.syslog_min_elevel = 19 # WARNING and above logforward.syslog_format = 'syslog' logforward.syslog_facility = 'local1' logforward.jsonsrv_host = '127.0.0.1' logforward.jsonsrv_port = 23457 logforward.jsonsrv_message_filter = 'connect' logforward.jsonsrv_format = 'json' logforward.netstr_host = '127.0.0.1' logforward.netstr_port = 23458 logforward.netstr_message_filter = 'foo|bar|baz' # match any of the foo, bar or baz logforward.netstr_funcname_filter = 'exec_simple_query' # filter on function calling ereport call (list) logforward.netstr_format = 'netstr' Note that you need to copy the shared library also to $libdir/plugins if you are planning to use local_preload_libraries instead of shared_preload_libraries. 

About

Logging handler for forwarding PostgreSQL log messages to network.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published