Splunk Search

Search to compare fields where field1 has both entries in field2?

karthik4455
Explorer

I wish to run a query where I need to see if field1 has both entries in field2. Ex: I need to query the results like A & E which has both Escalated and Closed status.

Field status
A Escalated
A Closed
B Closed
C Escalated
D Escalated
E Escalated
E Closed

Tags (2)
1 Solution

somesoni2
Revered Legend

Try this

your base search giving fields 'Field' and 'status' | eventstats  count(status) as statusCount by Field | where statusCount > 1

Update

Give this a try

 your base search giving fields 'Field' and 'status' | stats values(status) as status by Field delim=" & " | where mvcount(status) > 1 | nomv status

View solution in original post

somesoni2
Revered Legend

Try this

your base search giving fields 'Field' and 'status' | eventstats  count(status) as statusCount by Field | where statusCount > 1

Update

Give this a try

 your base search giving fields 'Field' and 'status' | stats values(status) as status by Field delim=" & " | where mvcount(status) > 1 | nomv status

karthik4455
Explorer

Thanks a lot. It worked.

0 Karma

somesoni2
Revered Legend

Try the updated answer.

0 Karma

karthik4455
Explorer

Can you tell me how I can filter the output as follows:
You could notice the output doesn't have B,C & D because they should be dropped.

A Escalated & Closed
E Escalated & Closed

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...