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!

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

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 ...