Alerting

How do I set an alert out of a search query?

gingersoftware
New Member

Hi,

I have this search query:

tag=NginxLogs host=www* |stats count by status|eventstats sum(count) as total|eval perc=round((count/total)*100,2)|where status="404" AND perc>5

In the result "Statistics" tab, the results I receive can be seen in the image I attached and here:

status 404
count 545
perc 16.55
total 3293

When I try to add an alert ("Save as Alert") for that query, I add all needed fields and action (send email), and on "Trigger alert when" (in Trigger Condition section) I choose "custom" and add the following line in the text box: "perc > 5" since I want the alert to send emails once the percentage is equal or above 5%.

Unfortunately, I receive the error: "In handler 'saved search': Cannot parse alert condition. Unknown search command 'perc'."

Not sure how to proceed.

Your help is appreciated.

Thanks,

alt text

Tags (2)
0 Karma
1 Solution

jkat54
SplunkTrust
SplunkTrust

Leave the trigger condition as “number of results is greater than 0” and use your full search:

tag=NginxLogs host=www* |stats count by status|eventstats sum(count) as total|eval perc=round((count/total)*100,2)|where status="404" AND perc>5

Your search is “doing” the trigger condition already with the where clause.

View solution in original post

jkat54
SplunkTrust
SplunkTrust

Leave the trigger condition as “number of results is greater than 0” and use your full search:

tag=NginxLogs host=www* |stats count by status|eventstats sum(count) as total|eval perc=round((count/total)*100,2)|where status="404" AND perc>5

Your search is “doing” the trigger condition already with the where clause.

gingersoftware
New Member

Thanks, Works on Splunk.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...