Thread: [MASSMAIL]pgBadger with Pgaudit

[MASSMAIL]pgBadger with Pgaudit

From
Daulat
Date:
We are using pgaudit with our postgres v.14.6 with the following audit options. But there are no details in the pgbadger report for insert, delete and update while generating except select queries.

log_destination = 'csvlog'
logging_collector = on
log_directory = '/postgres/dblogs'
log_filename = 'postgresql_%A-%d-%B-%Y_%H%M'
log_truncate_on_rotation = on
log_rotation_size = 0
log_rotation_age = 1d
log_min_duration_statement = -1
log_checkpoints = on
log_connections = on
log_disconnections = on
log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h'
log_lock_waits = on
log_statement = 'none' 
log_timezone = 'US/Eastern'
timezone = 'US/Eastern'

pgaudit.log = 'ddl,write'
pgaudit.log_relation = 'on'
shared_preload_libraries = 'pgaudit'

Does the pgbadger tool support DML operations /queries in their report?

If yes , please suggest how we can do it.

Thanks,
Daulat


Re: pgBadger with Pgaudit

From
Guillaume Lelarge
Date:
Hello,

Le ven. 5 avr. 2024 à 11:55, Daulat <daulat.dba@gmail.com> a écrit :
We are using pgaudit with our postgres v.14.6 with the following audit options. But there are no details in the pgbadger report for insert, delete and update while generating except select queries.

log_destination = 'csvlog'
logging_collector = on
log_directory = '/postgres/dblogs'
log_filename = 'postgresql_%A-%d-%B-%Y_%H%M'
log_truncate_on_rotation = on
log_rotation_size = 0
log_rotation_age = 1d
log_min_duration_statement = -1
log_checkpoints = on
log_connections = on
log_disconnections = on
log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h'
log_lock_waits = on
log_statement = 'none' 
log_timezone = 'US/Eastern'
timezone = 'US/Eastern'

pgaudit.log = 'ddl,write'
pgaudit.log_relation = 'on'
shared_preload_libraries = 'pgaudit'

Does the pgbadger tool support DML operations /queries in their report?

If yes , please suggest how we can do it.


AFAIK, pgbadger isn't compatible with pgaudit log lines. You need to configure PostgreSQL so that it logs queries, for example with log_min_duration_statement, just as the documentation says (https://pgbadger.darold.net/documentation.html#LOG-STATEMENTS).


--
Guillaume.