Splunk Search

Count by Day of Week

Craig_Ph
Loves-to-Learn Lots

I am on Day 2 with Splunk.

I am trying to get the average number of records by Day of the Week (Mon, Tue, Wed, etc) of the specified timespan.  I can get the total counts by Day of the Week, but I can't seem to get the average number of transactions per Day of the Week.

This gets me the total number of transactions for each day of the week in that timespan:
index=xxxxxxxxxxxxx
| eval day=strftime(_time,"%a")
| stats count by day

How do I get this to average out so that if I have 1000 records for Mondays and I have 4 Mondays in that timespan then I get the value to be 250?

I found this post from 2014, but I can't get that to work:  https://community.splunk.com/t5/Splunk-Search/day-of-the-week-average/m-p/142904

Labels (2)
0 Karma

bowesmana
SplunkTrust
SplunkTrust

try this

index=xxxxxxxx
| bin _time span=1d
| eval day=strftime(_time,"%a")
| stats dc(_time) as days count by day
| eval average_count = count / days
0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...