How to mask a value from postgresql.log while logging

308 Views Asked by At

I'm in need of masking some sensitive data from logging in postgresql.log

For Example, Let's say I want mask "password@123" from postgresql.log while logging with "******"

I tried below configuration,

log_line_prefix = '%t [%p]: REGEXP_REPLACE(%m, ''password@123'', ''******'') '

log_redact = '(password@123)'

But seems it's not working. Please help me to find a solution

1

There are 1 best solutions below

0
Laurenz Albe On

There is no way to specifically exclude certain parts of a log message from being logged. Your only option is to disable statement logging completely:

log_min_error_statement = panic
log_statement = none
log_min_duration_statement = -1