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!

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 ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...