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!

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

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...