Skip to content

ckh0618/pg_logfilter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pg_logfilter

pg_logfilter is PostgreSQL Extension to filt postgresql output log if it matches given patterns.

How to build

$ git clone https://github.com/ckh0618/pg_logfilter.git
$ cd pg_logfilter 
$ USE_PGXS=1 make; make install 

Installation

You should add pg_logfilter to shared_preload_libraries. Restarting database cluster is required.

shared_preload_libraries = '$libdir/pg_logfilter'

Configuration

Those are configures. You can specifiy multiple values using "," deletemeters.

  • pg_logfilter.user_name : if a log is generated by specified user list, pg_log ignores the log.
  • pg_logfilter.application_name : If a log is generated by specified application list, pg_log ignores the log.
  • pg_logfilter.sqlcode : If a log with spcified sqlcode list, pg_log ignores the log.
  • pg_logfilter.client_ip : If a log is generated by specified ip list ( client ipaddress) , pg_log ignores the log.
  • pg_logfilter.database_name : pg_log ignores the log if the log generated by specified by database list.

You can modify these configures using "ALTER SYSTEM" command and issue "pg_ctl reload" to apply changes.

Example.

pg_logfilter.user_name = 'han,bb'
pg_logfilter.application_name = 'ap1,ap2,ap3'
pg_logfilter.sqlcode = '00021,32312,20222'
pg_logfilter.database_name = 'my,data,base'
pg_logfilter.client_ip = '122.12.11.1,0.0.0.1'

Tested Database

Those database version are tested.

  • PostgreSQL 11
  • Enterprisedb 11
  • Enterprisedb 10

License

the PostgreSQL License

About

Filtering postgresql output log if it matches given patterns.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published