Splunk Search

field with exclusively one value

monika0511
Explorer

here is how my base search output looks:

nameversionbrowserrunTime
call1alphachrome75
call1betachrome48
call2alphafirefox30
call2betachrome78
call3betafirefox56

I'm looking for a distinct list of "name, browser" that exclusively belongs to "beta" version. Getting count and median values is a bonus.

Here is the desired output:

nameversionbrowsercount(runTime)median(runTime)
call2betachrome130
call3betafirefox156


This is what I have so far: But this only gives me a diff. It can return alpha calls if those are not present in beta version. I'm looking for ONLY beta calls. 

 

baseSearch | stats dc(version) as found_in_versions BY name, platform | where found_in_versions < 2

 

 Any help would be appreciated!

Labels (2)
1 Solution

monika0511
Explorer

Here is how I was able to do it:

baseSearch | eval found_in_base_search=1 | append [ subSearch | eval found_in_sub_search=1 ] | eventstats values(found_in_base_search) AS found_in_base_search BY name | where isnull(found_in_base_search) AND isnotnull(found_in_sub_search) | stats count(runTime), median(runTime) by name, version

View solution in original post

monika0511
Explorer

Here is how I was able to do it:

baseSearch | eval found_in_base_search=1 | append [ subSearch | eval found_in_sub_search=1 ] | eventstats values(found_in_base_search) AS found_in_base_search BY name | where isnull(found_in_base_search) AND isnotnull(found_in_sub_search) | stats count(runTime), median(runTime) by name, version

richgalloway
SplunkTrust
SplunkTrust

Filter the desired events in the base search or a where clause.

baseSearch version=beta 
| stats dc(version) as found_in_versions BY name, platform 
| where found_in_versions < 2

 

baseSearch 
| where version=beta
| stats dc(version) as found_in_versions BY name, platform 
| where found_in_versions < 2

 

---
If this reply helps you, Karma would be appreciated.
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...