I am looking for a way to compare an hourly ave(count) with the All time historic average.
Below is a sample query provided by FrankVl.
index=some_db sourcetype=syslog_transactions
|bin _time span=1h
| stats count as hourly_count by USER, _time
| sort _time
| streamstats avg(hourly_count) as historic_avg by USER
This works fine for last 24 hours; but now I want to look at the last 24 hours "hourly_count" and compare it to an 'All time' running ave(hourly_count).
My overall objective is to create a behavioral detection where I can also set a threshold to see when transactions spike up.
For example, if user X has a normal range of transactions every hour (between 0-100/hr) and suddenly user X jumps up 10x the normal like 1k transactions/hr, then I want to be able to find this based on a calculation against the normal average for all time.
And then I want to exclude the hourly_counts that are abnormal (like 1000/hr vs 10/hr , 10/hr being normal) from the 'All time' average.
I reworked the above query and I can change the WHERE statement. But I feel like I am reinventing a wheel, as I am sure someone has probably needed a similar solution.
index=some_db sourcetype=syslog_transactions
|bin _time span=1h
| stats count as hourly_count by USER, _time
| sort _time
| streamstats avg(hourly_count) sum(hourly_count) by USER
| WHERE hourly_count > (10*hourly_avg)
Please advise if there is a better way to do this.
Thank you
... View more