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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...