Getting Data In

Problem anonymizing data in Splunk

justynap_ldz
Path Finder

We want to anonymize the usernames in the following event using sed script.

Raw event:

{"externalId": null, "statusChanged": "2021-02-09T09:51:42.000Z", "userName": "thisisatestuser@123.pl ", "appid": "0oa97rn2ymPrbgM430x612344", "lastUpdated": "2021-02-09T09:51:42.000Z", "scope": "", "userid": "00u1a2mn8ouOvSO2A0x71234", "created": "2021-02-09T09:51:42.000Z", "status": "ACTIVE"}

However, either the stanza in props.conf is incorrect or we did it in the wrong place.

Current config:
1. input is specified on a Heavy Forwarder in an app local folder (we just activated inputs after installing an app in the FrontEnd and that is how this entry was created)
2. we added the following SEDCMD stanza in /opt/splunk/etc/system/local/props.conf on a Heavy Forwarder: 

[testapp:appUser]
SEDCMD-TestApp_username1=s/userName:(\d{6})/userName:XXXXXX/1

Does anyone have any idea on how to solve it?

0 Karma

to4kawa
Ultra Champion
index=_internal | head 1 | fields _raw
| eval _raw="{\"externalId\": null, \"statusChanged\": \"2021-02-09T09:51:42.000Z\", \"userName\": \"thisisatestuser@123.pl \", \"appid\": \"0oa97rn2ymPrbgM430x612344\", \"lastUpdated\": \"2021-02-09T09:51:42.000Z\", \"scope\": \"\", \"userid\": \"00u1a2mn8ouOvSO2A0x71234\", \"created\": \"2021-02-09T09:51:42.000Z\", \"status\": \"ACTIVE\"}"
| rex mode=sed "s/(userName\":\s*\").*@/\1XXXXXX@/"

your SEDCMD is wrong.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Your user name looks like an e-mail address whereas your sed is looking for 6 digits.

0 Karma
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Reprocessing XML into Fixed-Length Events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

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