Dashboards & Visualizations

How to mask data for a particular field?

power12
Communicator

Hello Splunkers ,

I have the following sample data .I want to mask the data after VIN(bold) to xxxxxx before indexing .Also if the data is already ingested before need to. mask it on dashboards .I know SED command is used but I dont know how to use that 

 

search ownership for claimnumber = " ----" with request payload={

"tID" : ---------------
"adminInfo" : {
},
"cNumber" : " --------",
"ier" : " -----",
"dateofloss": "------",
"vehicleinformation": {
"vin":  "2323213123123" ,
"vee": "A"
}
"tis":{
"state":"XYZ"
},
"on": "N"
"county":"-------"
}
 
 
Thanks in Advance
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @power12,

you can test the regex also using the rex command in a search:

<your_search>
| rex mode=sed "s/\"vin\":\s+\"\d+\"/\"vin\": \"XXXXXXXXXX\"/g"

and it runs in my test

gcusello_0-1678171211324.png

could you share the props.conf you used?

Ciao.

Giuseppe

 

View solution in original post

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @power12,

if you want to replace the number after "vin" with some "XXXXXXXXXX", you have to use in props.conf:

[your_sourcetype]
SEDCMD-mask = s/\"vin\":\s+\"\d+\"/\"vin\":\s+\"XXXXXXXXXX\"/g

this props.conf must be located on Indexers or (uf present) on heavy Forwarders.

Ciao.

Giuseppe

0 Karma

power12
Communicator

@gcusello I tried using the one you sent in props.conf .It looks like below.


\"vin\":\s+\"XXXXXXXXXX\" ,

 

It should be 
"vin": "XXXXXXX" ,

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @power12,

you can test the regex also using the rex command in a search:

<your_search>
| rex mode=sed "s/\"vin\":\s+\"\d+\"/\"vin\": \"XXXXXXXXXX\"/g"

and it runs in my test

gcusello_0-1678171211324.png

could you share the props.conf you used?

Ciao.

Giuseppe

 

0 Karma

power12
Communicator

@gcusello  It worked I think I had a typo

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @power12,

good for you, see next time!

Ciao and happy splunking.

Giuseppe

P.S.: Karma Points are appreciated 😉

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...