Splunk Search

Why are some fields from XML data not displayed in search results?

alexandermunce
Communicator

When I conduct a generic search on one of our Splunk sources, I am looking for relevant data which will assist with categorizing and analyzing the data.

I noticed that this particular batch of data did not have too many unique identifying fields which were useful for my analysis (eg, customer id, etc).

However, when I took a closer look at some of the results XML data, I could see that there was indeed some relevant identifying data which was contained within tags. For example, for the purpose of this question lets say;

< customer-id >0100000< /customer-id >

(Without the spaces)

I am wondering why this data does not display as a field which I can manipulate/sort by/etc within the search results.

Is this not a valid XML tag which is therefore a field?

0 Karma
1 Solution

ktugwell_splunk
Splunk Employee
Splunk Employee

If the data is close it, or is valid XML, Splunk will recognise it and extract the fields. But you usually have to tell splunk that the data is XML.

Your search | xmlkv

This will tell splunk to extract XML fields at search time. This is however not the most efficient way.

You can set this in your sourcetype (props.conf)

[your_sourcetype]
...
KV_MODE = xml 

Give this a try

Thanks

View solution in original post

ktugwell_splunk
Splunk Employee
Splunk Employee

If the data is close it, or is valid XML, Splunk will recognise it and extract the fields. But you usually have to tell splunk that the data is XML.

Your search | xmlkv

This will tell splunk to extract XML fields at search time. This is however not the most efficient way.

You can set this in your sourcetype (props.conf)

[your_sourcetype]
...
KV_MODE = xml 

Give this a try

Thanks

alexandermunce
Communicator

Perfect, thank you kindly!

Looks like there are too many irrelevant fields extracted if I use the xmlkv command, so I think I will have to use the rex command to extract the fields I require!

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...