Alerting

Alert on low average when comparison with other events

sahil237888
Path Finder

Hi,
Please help.

Step1 : Calculate combined average of an event (event name : mytest here) from source file a,b,c.
Step 2 : calculate average of mytest event from each soucve file a,b,c individually.
Step 3 : compare if there is 50% change when comparing individual average with combined average.

Tags (1)
0 Karma
1 Solution

erikahanlon
Engager

It sounds like you want to use something like eventstats for what you're trying to accomplish. Eventstats gives you a way of "zooming out" and giving you metrics from the wider set of events to use for comparison to values in individual events.

Try something like this:

<base search>
| stats avg(fieldName) as source_average by eventName, source 
| eventstats avg(source_average) as combined_average by eventName 
| eval pct_diff=abs(100*(combined_average-source_average/combined_average))
| where pct_diff > 50

View solution in original post

0 Karma

erikahanlon
Engager

It sounds like you want to use something like eventstats for what you're trying to accomplish. Eventstats gives you a way of "zooming out" and giving you metrics from the wider set of events to use for comparison to values in individual events.

Try something like this:

<base search>
| stats avg(fieldName) as source_average by eventName, source 
| eventstats avg(source_average) as combined_average by eventName 
| eval pct_diff=abs(100*(combined_average-source_average/combined_average))
| where pct_diff > 50
0 Karma

sahil237888
Path Finder

@erikahanlon,

Thanks.
This gave me clue for implementing this.

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!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

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