I use logback (logback-gelf) to log in my spring boot application. It has configuration xml file and I try to write regular expression to mask all words containing "passwords".
In configuration file. I write this:
%replace(%msg){'(?i)(password"\S+?")(\S+?)(".+)', '$1****$3'} //I use (?i) for case insensitiveness
It works but only for one password in a log. For example if my log like this:
{"oldPassword":"123456","password":"654321"}
It convert it to:
{"oldPassword":"****","password":"654321"}
I want to mask all words which contain password.
How can I do this?
By the way it works on online regex tester but don't works on logback-spring
(?i)(password"\S+?")(\S+?)"
This works for me.
Thanks @JvdV for helps.