How to mask sensitive data in logstash

i have to mask the Card no : 712345678901236, OTP : 1234, expiryDate:01/01/2018, cvv:000, MobileNo:1234567890

the masked data should be
Card no : 71231236, OTP : 14, expiryDate://20, cvv:**, MobileNo:12*******90

kindly suggest the regex method

Use mutate+gsub with capture groups. For example, to convert the card number to 71231236 you can use

mutate { gsub => [ "message", "Card no : ([0-9]{4})[0-9]+([0-9]{4}),", "\1\2" ] }

its will hide only card no, how about other entity?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.