Getting Data In

help with regex for masking?

abi2023
Path Finder

I need to mask data before it being index. my sample his log structure.

"2023-11-02 06:53:00 xx.xxx.xxx.xx GET /Security/Security/Logon 123 - xx.xxx.x.xxx Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/86.0.4240.198+Safari/537.36=RDPword=jsndksjs834u935=PDUserId=jsndksjs834u935=PDPword=jsndksjs834u935=RFuser=&securityToken=xxxxxxxx 200 0 0 14"

I need to match highlights in green "RDPword=jsndksjs834u935", and "PDPword=jsndksjs834u935"

I am using regex this matching the following which I don't want it match  "PDUserId=jsndksjs834u935="

RDPWord=([^=]+)=PDUUserId=([^=]+)=PDPWord=([^=]+)

Can someone help me 

Thanks

Labels (1)
Tags (1)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

If you just want a regex which you can use with SEDCMD, just match each part separately and substitute with nothing. And you can use the same match several times to match and substitute all matching strings.

Like

s/[RP]DPword=[^=]+//g
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Regex is very case-sensitive.  This matches the sample event.

RDPword=([^=]+)=PDUserId=([^=]+)=PDPword=([^=]+)
---
If this reply helps you, Karma would be appreciated.
0 Karma

abi2023
Path Finder

my following regex is matching  "RDPword=jsndksjs834u935=PDUserId=jsndksjs834u935=PDPword=jsndksjs834u935"

I want to exclude follwing "=PDUserId=jsndksjs834u935=" how do I modify the this rex to not match =PDUserId=jsndksjs834u935=
RDPword=([^=]+)=PDUserId=([^=]+)=PDPword=([^=]+)

RDPword=([^=]+)=PDUserId=([^=]+)=PDPword=([^=]+)




0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Maximizing the Value of Splunk ES 8.x

Splunk Enterprise Security (ES) continues to be a leader in the Gartner Magic Quadrant, reflecting its pivotal ...