Alerting

How do I create an alert that triggers based on the percentage of results?

jitin_ratra
New Member

I am trying to get the counts of events in a 60 minute timeframe with a span of every 10 minutes, and if the count is less than 80%, it should be compared to the last span of 10 mins, and then trigger an alert .

Is there a way to do this ?

i have following query so far but need help with the other part of question

index="test" | timechart count span=10m 

I have selected the timerange for 60mins

Tags (1)
0 Karma
1 Solution

bkirk
Path Finder

I think you want to add the following to your SPL:

 | streamstats current=f last(count) as last_count |eval Percent=if(isnotnull(last_count),round((count-last_count)/last_count*100,2)+100,100)

If that isn't what you want at least the streamstats should get you want you want. and then it is just about doing your calculation.

Thank you,
Brian

View solution in original post

0 Karma

bkirk
Path Finder

I think you want to add the following to your SPL:

 | streamstats current=f last(count) as last_count |eval Percent=if(isnotnull(last_count),round((count-last_count)/last_count*100,2)+100,100)

If that isn't what you want at least the streamstats should get you want you want. and then it is just about doing your calculation.

Thank you,
Brian

0 Karma

jitin_ratra
New Member

Awesome thanks @bkrik. That helped alot

0 Karma
Get Updates on the Splunk Community!

Developer Spotlight with Paul Stout

Welcome to our very first developer spotlight release series where we'll feature some awesome Splunk ...

State of Splunk Careers 2024: Maximizing Career Outcomes and the Continued Value of ...

For the past four years, Splunk has partnered with Enterprise Strategy Group to conduct a survey that gauges ...

Data-Driven Success: Splunk & Financial Services

Splunk streamlines the process of extracting insights from large volumes of data. In this fast-paced world, ...