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!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...