Splunk Search

Is this a Join, subsearch, or something else?

theeven
Explorer


In my search I am at a stage where I have something like below.

USERID EVENT STATUS
1 HELLO PASS
2 HELLO FAIL
3 HELLO FAIL
4 HELLO PASS
2 HELLO PASS
3 HELLO PASS
7 HELLO FAIL
4 HELLO PASS
8 HELLO PASS

I need a way to list all USERID who have encountered both PASS and FAIL STATUS

2
3

help?
thanks.

Tags (1)
1 Solution

gkanapathy
Splunk Employee
Splunk Employee

Pretty straightforward:

... | stats values(STATUS) as statuses by USERID | where statuses=="PASS" AND statuses=="FAIL"

View solution in original post

gkanapathy
Splunk Employee
Splunk Employee

Pretty straightforward:

... | stats values(STATUS) as statuses by USERID | where statuses=="PASS" AND statuses=="FAIL"

theeven
Explorer

Okay here's my solution. Works good for me.

| stats values(STATUS) as STATUS_MV by USERID 
| eval STATUS_COUNT = mvcount(STATUS_MV) 
| search STATUS_COUNT=2

In my case, Status can only take one of the 2 conditions (PASS/FAIL). In other case ">" operator could also be used.

Runals
Motivator

That is similar to how I would approach it

...| stats dc(STATUS) by USERID

0 Karma

theeven
Explorer

I am planning to group timechart per_day() at the end.

0 Karma

lukejadamec
Super Champion

How far back in time do you want to look?
For users that have both pass and fail, in the past hour, day, month?

0 Karma

theeven
Explorer

not sure if i get it.

0 Karma

yannK
Splunk Employee
Splunk Employee

I hate to say that, but maybe a transaction may be useful.

mysearch PASS OR FAIL | transaction USERID | search PASS AND FAIL | table USERID

HiroshiSatoh
Champion

I did not think of this. The Helpful simple.

0 Karma

lukejadamec
Super Champion

What is the timeframe?

0 Karma
Get Updates on the Splunk Community!

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...