Getting Data In

Anonymize only Child Nodes

jmaguire1992
Explorer

Hello,
I was wondering could anyone help me figure out the sed script required and regex to Anonymize child nodes from xml - The difficulty seems to be due to the fact each node takes it's own line within splunk rather than usual single line <testfield> 123 </testfield>. Here is an example of how it appears:

<userDetails> 
<name> 
<testfield> 
123
</testfield> 
</name>
</userDetails>

And the appearance I would want would be something like:

<userDetails> 
 <name> 
 <testfield> 
 xxxx
 </testfield>
 </name>
 </userDetails>

Any help would be great with this - thank you.

James

0 Karma
1 Solution

jmaguire1992
Explorer

I figured it out - Here is the answer for anyone who might need it.

 SEDCMD-testdata_anonymizer = s/(.*)<testfield>[\s\S]*?<\/testfield>.*/\1 <testfield>xxxx<\/testfield>/g

View solution in original post

0 Karma

jmaguire1992
Explorer

I figured it out - Here is the answer for anyone who might need it.

 SEDCMD-testdata_anonymizer = s/(.*)<testfield>[\s\S]*?<\/testfield>.*/\1 <testfield>xxxx<\/testfield>/g
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...