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!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...