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!

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, ...