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!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...