Alerting

How do I exclude multiple specific source-alerts from search results?

HenryFitzerald
New Member

I have four alerts and wanted to exclude these specific FOUR(ALERT1,ALERT2,ALERT3,ALERT4) from the alert trigger search.

I was expecting this query to work using NOT, but it does not work and ALERT1 & 2 currently appears. Could anyone please assist?

<query>index=universal_alerts_   
         NOT  ( source =ALERT1               AND
                      source =ALERT2              AND         
                      source =ALERT3              AND
                      source =ALERT4              AND
                     )
        | timechart count by source
</query>

This query seems a valid alternative?? But, I am not sure why ????

<query>  
             index=universal_alerts_   
                    ( source! =ALERT1              AND
                      source! =ALERT2              AND         
                      source! =ALERT3              AND
                      source! =ALERT4              AND
                     )
                 |  timechart count by source
</query>  
0 Karma
1 Solution

woodcock
Esteemed Legend

You are using AND and should be using OR like this:

index=universal_alerts_ AND NOT (source ="ALERT1" OR source ="ALERT2" OR source ="ALERT3" OR source ="ALERT4)
| timechart count by source

View solution in original post

0 Karma

woodcock
Esteemed Legend

You are using AND and should be using OR like this:

index=universal_alerts_ AND NOT (source ="ALERT1" OR source ="ALERT2" OR source ="ALERT3" OR source ="ALERT4)
| timechart count by source
0 Karma

HenryFitzerald
New Member

Thanks it should include an OR .

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@HenryFitzerald ,

You can try this also.

 <query>
    index=universal_alerts_ 
    NOT (source="ALERT1" OR source="ALERT2" OR source="ALERT3" OR source="ALERT4") 
| timechart count by source
 <query>

Thanks

0 Karma

Vijeta
Influencer

Try this

<query>  
              index=universal_alerts_   
                   NOT  source IN("ALERT1", "ALERT2","ALERT3","ALERT4")

                  |  timechart count by source
 </query>  
0 Karma

vishaltaneja070
Motivator

Hello @HenryFitzerald ,

try something like this:
index=universal_alerts_ NOT
[| makeresults | eval source= "ALERT1;ALERT2;ALERT3;ALERT4;" | eval source=split(source,";") | mvexpand source | fields - _time] | timechart count by source

0 Karma
Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...