Alerting

How can i add alert to my search query using trigger condition alert

neilfajardo15
Engager

Hi, Im setting up an alert for data flow the alert build is when the application is not running it will send us an alert and i use trigger condition in the alert. 
here is the search query 
| eval value1=if(like(sample, "value1"), 1,0), value2=if(like(sample, "value2"), 1,0), value3=if(like(sample, "value3"), 1,0)
| stats sum(value1) as VALUE1, sum(value2) as VALUE2, sum(value3) as VALUE3
| table VALUE1, VALUE2, VALUE3
 
and for the alert condition i use this command 
search VALUE1 = 0 

"0" because in the sum it indicates that the 0 means data is not flowing in splunk meaning the application is down 

Thanks in advance

Labels (1)
0 Karma

neilfajardo15
Engager

Hi thanks for the answer, but im still not able to receive alerts 😞 im using email alerts 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

How have you set up your alerts?

0 Karma

neilfajardo15
Engager

here is my original query
| eval amd-eu1=if(like(namespace, "amd-eu1"), 1,0),
amd-eu2=if(like(namespace, "amd-eu2"), 1,0), amd-eu3=if(like(namespace, "amd-eu3"), 1,0), amd-eu4=if(like(namespace, "amd-eu4"), 1,0),
amd-eu5=if(like(namespace, "amd-eu5"), 1,0), amd-ap1=if(like(namespace, "amd-ap1"), 1,0), amd-am1=if(like(namespace, "amd-am1"), 1,0)
| stats sum(amd-eu1) as AMD_EU1, sum(amd-eu2) as AMD_EU2, sum(amd-eu3) as AMD_EU3, sum(amd-eu4) as AMD_EU4, sum(amd-eu5) as AMD_EU5, sum(amd-ap1) as AMD_AP1, sum(amd-am1) as AMD_AM1

i have remove the table 

0 Karma

neilfajardo15
Engager

I use this and it is realtime 

neilfajardo15_0-1633434243428.png

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Rather than custom, can you use number of results returned by the search?

0 Karma

neilfajardo15
Engager

But due to the stats sum and the value inside it a table will be created then it will be a result for the search 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Put the where as part of your search rather than the custom condition on the alert

0 Karma

neilfajardo15
Engager

Hi, Sorry for the late reply the alert works but it was spamming a lot of mail and also even though the data is flowing it is still alerting 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You might want to use 

| where VALUE1=0

then you can alert on whether there are any results or not

Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

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