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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...