I am trying to mask the logs by chaining replace regex in logback.xml file.
%replace(%replace(%msg){'"email":(.*?),','"email":"****"'}){'"phone":(.*?),','"phone":"****"'}))
It's working, but is there any other regex solution instead of regex replace chaining?
Can we use regex something like this?
(%replace(%msg){'"(email|phone)":(:*?)','"***",'}
I tried the above but the format is not proper.
Required output is:
{"email":"****","phone":"****"}