Splunk Search

avg count for last 4 days

rameshlpatel
Communicator

Hi,

I have chart which showing application processed events in 24 hrs time range with span=1m. In same chart i have requirement to add history line chart of last 4 days avg processed events on same time (minute wise).

So here my problem is to create avg of last 4 days and show in same line chart for current day.

Tags (2)
0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Take a look at this:

index=_internal | timechart span=1m count | eval hms = strftime(_time, "%H%M%S")
| stats latest(_time) as _time latest(count) as count avg(count) as average values(_span) as _span by hms
| fields - hms | sort + _time

Run over the last four days this will produce two values for each time bucket in the last 24 hours, the average over four days and the most recent value. Format the chart to show the average as an overlay line over the count and you should be there.

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...