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!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...