Splunk Search

Incremental average over the time

CarmineCalo
Path Finder

Splunkers!
As usual I'm learn from you.

I'd need to plot an "incremental average" over time, i mean to calculate the average value of a field considering a static starting point , but the ending period corresponding to the time value.

Example:
Starting point Jan-2016, value to be averaged is the "Application Availability" (AppAv)
On Jan-16 i need the Average of AppAv only for the month
On Feb-16 average calculation will have to consider values both for Jan and Feb
ON Mar-16 average calculation will have to consider values from Jan to March
... and so on and so forth

Any hints?

Tks!
Carmine

0 Karma
1 Solution

mayurr98
Super Champion

try something like this !

<base_Search> 
| timechart span=1mon avg(AppAv) as app_av_avg 
| streamstats avg(app_av_avg) as cumulative_Avg 
| eval month_year=strftime(_time, "%b %Y")

let me know if this helps !

View solution in original post

mayurr98
Super Champion

try something like this !

<base_Search> 
| timechart span=1mon avg(AppAv) as app_av_avg 
| streamstats avg(app_av_avg) as cumulative_Avg 
| eval month_year=strftime(_time, "%b %Y")

let me know if this helps !

micahkemp
Champion

This will give an average of averages, which is probably not really what you want.

0 Karma

CarmineCalo
Path Finder

This is fine, I just need to tune in this way

| timechart span=1mon **sum**(AppAv) as app_av_avg
| streamstats avg(app_av_avg) as cumulative_Avg
| eval month_year=strftime(_time, "%b %Y")

as far as need to evaluate AppAv on weekly basis.

Tks!
Carmine

0 Karma

micahkemp
Champion

I believe you’re looking for streamstats.

Perhaps something like:

| timechart span=1mon count(AppAv) AS count, sum(AppAv) as sum_month 
| streamstats sum(count) as cumulative_count, sum(sum_month) as cumulative_sum 
| eval cumulative_average=cumulative_sum/cumulative_count
0 Karma
Get Updates on the Splunk Community!

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to Officially Supported Splunk ...