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!

Leveraging Detections from the Splunk Threat Research Team & Cisco Talos

  Now On Demand  Stay ahead of today’s evolving threats with the combined power of the Splunk Threat Research ...

New in Splunk Observability Cloud: Automated Archiving for Unused Metrics

Automated Archival is a new capability within Metrics Management; which is a robust usage & cost optimization ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...