Saurav_Sen
(Saurav Sen)
January 30, 2019, 10:38am
1
Trying to mask out a part (6-10th digit) of the 16 digit credit card.
1234567898763456 to 1234######3456
I can think of using gsub filter, but I can't find a way to match the exact section of numbers.
The option would be to split in various sections and then gsub the whole field to '#' and then join back, seems too much work. Any suggestions.
Something like this will mask the whole thing, which i don't want.
filter
{
mutate {
gsub => [
"message","[0-9]{16}","################"
]
}
}
danhermann
(Dan Hermann)
January 30, 2019, 11:46am
2
@Saurav_Sen , using regex capture groups along the lines of the example below should work for you:
filter
{
mutate {
gsub => [
"message","([0-9]{5})([0-9]{5})([0-9]{6})", "\1#####\3"
]
}
}
1 Like
Saurav_Sen
(Saurav Sen)
January 31, 2019, 3:35am
3
Thanks a lot @danhermann , i tweaked it a bit to get the combination I wanted.works great
eg:
9999999999999999 to 999999######9999
filter {
mutate {
gsub => [
"message","([0-9]{6})([0-9]{6})([0-9]{4})", "\1######\3"
]
}
}
system
(system)
Closed
February 28, 2019, 3:35am
4
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.