Dashboards & Visualizations

Extract key-value pairs from xml file

rxdeleon
Explorer

Here's a snippet of a long XML file. I would like to extract the keys such as id, status, error_sequence_number, etc. then assign the value as indicated by the string "value=".
























































Tags (1)
0 Karma

araitz
Splunk Employee
Splunk Employee
0 Karma

martin_mueller
SplunkTrust
SplunkTrust

When defining field extractions for this sourcetype in transforms.conf you can use a regex like so:

[some_stanza]
...
REGEX  = name="(?<_KEY_1>[^"]+)"\s+value="(?<_VAL_1>[^"]+)"
...

Note, you may want to define two of those if the order of name and value can be reversed in your data.

0 Karma
Get Updates on the Splunk Community!

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...