Splunk Search

Is it possible to use saved searches to exclude results in another search?

crades
Engager

Is it possible to use saved searches to exclude results in another search?

Something like :

Error NOT IN savedsearch("knownIssue1", "knownIssue2")

Thanks

somesoni2
Revered Legend

Its is possible (not in the format you mentioned) using subsearch as filter. May be something like this (assumming both the saved searches have field called Error which you need to filter from base search)

your base search e.g. index=xxx sourcetype=yyy NOT [|savedsearch knownIssue1 | table Error | append [|savedsearch knownIssue2 | table Error]] |...rest of the search

Samples of subsearch being used as filter
http://answers.splunk.com/answers/89845/filter-search-results-based-on-return-value-of-subsearch

crades
Engager

Cool. That should work for me.

Thanks for the answer and link.

0 Karma

somesoni2
Revered Legend

Good catch. Totally missed that one.

martin_mueller
SplunkTrust
SplunkTrust

Don't forget the NOT before the first opening square bracket to exclude the key-value-pairs from the subsearch rather than to require them.

Get Updates on the Splunk Community!

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

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...