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!

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

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