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!

Earn a $35 Gift Card for Answering our Splunk Admins & App Developer Survey

Survey for Splunk Admins and App Developers is open now! | Earn a $35 gift card!      Hello there,  Splunk ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...