xmlkv command automatically extracts key-value pairs from XML-formatted data.
For JSON-formatted data, use the
The required syntax is in bold.
- Syntax: <field>
- Description: The field from which to extract the key and value pairs.
- Default: The
- Syntax: maxinputs=<int>
- Description: Sets the maximum number of events or search results that can be passed as inputs into the
xmlkvcommand per invocation of the command. The
xmlkvcommand is invoked repeatedly in increments according to the
maxinputsargument until the search is complete and all of the results have been displayed. Do not change the value of
maxinputsunless you know what you are doing.
- Default: 50000
xmlkv command is a distributable streaming command. See Command types.
Keys and values in XML elements
From the following XML,
name is the key and
Settlers of Catan is the value in the first element.
<game> <name>Settlers of Catan</name> <category>competitive</category> </game> <game> <name>Ticket to Ride</name> <category>competitive</category> </game>
1. Automatically extract key-value pairs
Extract key-value pairs from XML tags in the
_raw field. Processes a maximum of 50000 events.
... | xmlkv
2. Extract key-value pairs in a specific number of increments
Extract the key-value pairs from events or search results in increments of 10,000 per invocation of the
xmlkv command until the search has finished and all of the results are displayed.
... | xmlkv maxinputs=10000
This documentation applies to the following versions of Splunk Cloud Platform™: 8.0.2006, 8.0.2007, 8.1.2009, 8.1.2012, 8.1.2011, 8.1.2101, 8.1.2103, 8.2.2104, 8.2.2105 (latest FedRAMP release), 8.2.2106, 8.2.2107, 8.2.2109