Splunk Search

How to exclude search query results from base search

barunbiswas
New Member

I have file processing events with 2 stages - X & Y. I want to get filenames which have gone through X but not Y. I am unable to do so. Could you please advise?
I can list filenames with X stage or Y stage as below

index=test stage=X | stats values(filename)
index=test stage=Y | stats values(filename)

Tags (1)
0 Karma
1 Solution

somesoni2
SplunkTrust
SplunkTrust

Try like this

index=test stage=X OR stage=Y | stats values(stage) as stages by filename | where mvcount(stages)=1 AND stages="X"

Basically select rows for both stages, generating list of stages each filename has gone through and finally, selecting only events which went though single stage which is "X".

View solution in original post

0 Karma

somesoni2
SplunkTrust
SplunkTrust

Try like this

index=test stage=X OR stage=Y | stats values(stage) as stages by filename | where mvcount(stages)=1 AND stages="X"

Basically select rows for both stages, generating list of stages each filename has gone through and finally, selecting only events which went though single stage which is "X".

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...