Alerting

Alert when sum of values is greater than 25% of sum of other values

kelseycasco
New Member

I would like to make an alert that is triggered when the sum of some values is greater than 25% of the sum of another set of values. Basically, I would like to alert the user when the quantity of scrap produced is greater than 25% of however much quantity is produced. Right now I have the following in a search:

index=wipscrap OR index=componentscrap
| stats sum(Scrap) AS totalscrap sum("Qty Good") AS totalqty
| eval scrapallowed=totalqty*.25

This gives me a table with three columns and the sum of the values for each column. Do I need more information in my search for this alert to work? What would my custom trigger be to make this work?

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi kelseycasco,
you could add at the end of your search

| where totalscrap>scrapallowed

in this way, if you have results alert is triggered otherwise it's ok.
So you can set an alert when results are greather than zero.

Bye.
Giuseppe

0 Karma

Sukisen1981
Champion

just add a where condition
index=wipscrap OR index=componentscrap
| stats sum(Scrap) AS totalscrap sum("Qty Good") AS totalqty
| eval scrapallowed=totalqty*.25 |where totalscrap >scrapallowed
Trigger alert if results are more than 0 should do it

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...