Splunk Search

Calculating average by week?

vonsolo29
Explorer

how do Icalculate the average number of events for each week for this search

index=dcl EventCode=4740 | eval date=strftime(_time,"%Y-%m-%d") | timechart span=7d count
Labels (1)
Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

If you want a simple average daily count over a week, try this untested query:

index=dcl EventCode=4740 | timechart span=7d count as Avg | eval Avg=round(Avg/7, 2) 
---
If this reply helps you, Karma would be appreciated.

JoshSaunders
Explorer

And is there a way to restrict the average for the first query to only Monday through Friday of the current week, but also only include days that have past (for example, if it's Thursday, show the daily average for Monday through Thursday)?

Tags (1)
0 Karma

JoshSaunders
Explorer

Thank you for this. How would you do that same thing, but for daily average for this month only?

Tags (1)
0 Karma
Get Updates on the Splunk Community!

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...