Knowledge Management

Can you help me extract an event between tags?

jip31
Motivator

Hello

I have XML logs and I want to extract all the text between these tags
What is the better way to do this please???

 "<Data><EventData></Data></EventData>"
Tags (1)
0 Karma
1 Solution

FrankVl
Ultra Champion

Assuming this is related to you other question, the EventData_Xml field is already extracted and looks like <Data>...text...</Data>, right?

So you want to get the part from between the Data tags?

| rex field=EventData_Xml "\<Data\>(?<EventData_Data>[^\<]+)\<\/Data\>"

https://regex101.com/r/rd8Qtp/1

View solution in original post

0 Karma

FrankVl
Ultra Champion

Assuming this is related to you other question, the EventData_Xml field is already extracted and looks like <Data>...text...</Data>, right?

So you want to get the part from between the Data tags?

| rex field=EventData_Xml "\<Data\>(?<EventData_Data>[^\<]+)\<\/Data\>"

https://regex101.com/r/rd8Qtp/1

0 Karma

jip31
Motivator

many thanks

0 Karma

FrankVl
Ultra Champion

That doesn't look like valid XML, are you sure the tags occur in that order? I would expect the </Data> to come behind the </EventData>.

0 Karma

jip31
Motivator

yes you are right sorry

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

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