0

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

Sakthis
  • 5
  • 3
  • There is no solution for that. Don't send things to the database that you don't want the database to know. – Laurenz Albe Mar 15 '23 at 17:28
  • @LaurenzAlbe We are okay to know to database. Just want to mask in postgresql.log only. Can't we achieve this? – Sakthis Mar 16 '23 at 04:32

1 Answers1

0

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
Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263