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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...