Splunk Search

extract only xml part from an event

eranhauser
Path Finder

Hi,
my event has unstructured data i.e. few strings than xml part than few more strings and another xml follow by few more strings.
How do I extract only the xml parts from the event when there is no pattern  to the string i.e. number of lines before and after the xml nor the string content has a pattern.

 

 

Tags (1)
0 Karma

eranhauser
Path Finder

it loos like
this is the first line
this is the second line

<!DOCTYPE....>

......... the rest of the xml is here

this is the third line

<!DOCTYPE...>

.......rest of the xml is here

this is the fourth line

this is the fifth line

0 Karma

isoutamo
SplunkTrust
SplunkTrust

Is there any word or some token how you know where first xml part will ends or is it just end of line and then 3rd line is some other text?

0 Karma

eranhauser
Path Finder

I am trying to get values from xml part of an event. The event starts with few lines than it has xml part, after that few more lines and another xml part. I want to extract at first only the parts of the event that are in xml format.

0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

until you give some sample data to us, it’s hard to tell exactly how to do it. Here is some ideas how to proceed with this case

...
| rex "....(?<yourXML>....until it ends)...."
| fields _time yourXML
| xmlkv maxinputs=99999 yourXML
....

r. Ismo

 

0 Karma

richgalloway
SplunkTrust
SplunkTrust

We need more information. Are you trying to extract at search time or index time?  Are you trying keep the XML or discard it?  Please share a sanitized sample event or two.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

CX Day is Coming!

Customer Experience (CX) Day is on October 7th!! We're so excited to bring back another day full of wonderful ...

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...