Splunk Search

Filter the results of the main search based on the field values from the subsearch.

pkakodkar
Loves-to-Learn

 

I have 2 independent queries run on 2 different index that give me a list of requestIds. I want to filter/not include the requestIds of the second query in my search. I am trying to use the following query to do so but its not filtering the results from second query. What am i doing wrong here 

 

index="index1" <query1> | rename requestId AS Result | table Result | search NOT [search index="index2" <query2>| rename RequestId AS Result| table Result]

Labels (2)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try the second query as part of the first search, something like this

first query NOT [second query | table requestId]

 

0 Karma

pkakodkar
Loves-to-Learn

@ITWhisperer  

I updated the query i am using in the thread above.

The query you sent doesnt work . It doesnot filter out the results.

One thing to note is in the first query the fieldName is "requestId" and secondquery has fieldName is "RequestId"  Hence i am renaming the field to see if it works

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Here is a runanywhere search showing this technique working

| makeresults count=10 
| streamstats count as row 
| eval result=mvindex(split("ABC",""),row%3)
| search NOT
    [| makeresults
    | eval result=split("AB","")
    | mvexpand result]

Perhaps there is something else going on in your search or your data which might explain it. Can you share more?

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