Splunk Dev

Multyple sources display only one value



How can I display in a single value chart only the value that is 2 when that occurs, or a single value 1 when other values are not present in a given time frame

Events :

source = A value = 1
source = B value = 1
source = C value = 1
source = D value = 1
source = A value = 1
source = B value = 2
source = C value = 1
source = D value = 1

My search :

sourcetype=test | dedup value | stats last(value)

Result :

Will only show me the value = 1 and if value = 2 occurs, I do not see it.

Please assist.

Tags (1)
0 Karma

Esteemed Legend

Like this:

 sourcetype=test | dedup value source


sourcetype=test | stats earliest(value) latest(value) min(value) max(value) avg(value) BY source

Depending on what priority you have regarding each source's value.

0 Karma


'stats last(value)' shows the oldest value
'stats latest(value)' shows the newest value in the index

Both require accurate timestamping and do not take into account data that could be in flight / indexing lag. Meaning the results could vary based on when you run the search and how long it takes data to "get/be" there.

I get the feeling you've greatly simplified what the possible values are and you're really looking for deviations from the common values though.

If that's the case you might be looking for something a bit more complicated like this

rootSearchHere NOT [ rootSearchHere | top 1 value by source | return $source $value] | stats values(value) by source

This would remove the top 1 most common values per source from the search and return the other values by source.


That seems like great questionmancy. Upvote for divining the purpose of the question and aiming to solve the underlying issues rather than answer only what was asked.

0 Karma


Cheers Mate!

0 Karma


You just need to change from last to max()

<Your Base Search>
| stats max(value) as MaxValue by source
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Get Updates on the Splunk Community!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

 (view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...