Splunk Search

How to show the most common non-null value in every field?

seajay1221
Engager

I have an index with ~200 fields and need to know the single most common non-null value for each field. How do I uncover that with Splunk?

In this example, I'd start here:

FruitsSizesIntegers
apple 1
bananalarge10
strawberry 3
apple 3
blueberrylarge2

 

And would aim to end up here:

FruitsSizesIntegers
applelarge3

 

I don't have a test query to share since I'm not sure how to begin approaching this, and haven't seen anything on the forum here that is a close match. Would greatly appreciate any insights into how to get this done!

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

As @richgalloway  use the mode function - if you don't want to list all 200 fields on the stats command, try this

| stats mode(*) as *

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

As @richgalloway  use the mode function - if you don't want to list all 200 fields on the stats command, try this

| stats mode(*) as *

richgalloway
SplunkTrust
SplunkTrust

Try the stats command with the mode function.

| stats mode(Fruits) as Fruits, mode(Sizes) as Sizes, mode(Integers) as Integers

 

---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...