Splunk Search

How to exclude weekends (Saturday and Sunday) from a transaction search and and order the days chronologically?

RVDowning
Contributor

I have the following search:

source="c:\\logs\\aaaa" 
 | transaction bbbb startswith=("CCCC STARTED") endswith=("CCCC ENDED") 
 | eval day_of_week = strftime(_time,"%A")
 | bin span=1d _time
 | stats count dc(_time) as days by day_of_week
 | eval average_count = count / days
 | eventstats avg(average_count)

which works fine. But there are hardly any transactions on Saturdays or Sundays, so the average per day is skewed. It would be nice to be able to totally exclude these days. The Search function has previous Business Week, but not something like "Business Days Only."

Also, is there any way to order the days chronologically?

Tags (3)

richgalloway
SplunkTrust
SplunkTrust

Perhaps this will help.

source="c:logsaaaa"
| transaction bbbb startswith=("CCCC STARTED") endswith=("CCCC ENDED")
| eval day_of_week = strftime(_time,"%A")
| where NOT (day_of_week="Saturday" OR day_of_week="Sunday")
| bin span=1d _time
| stats count dc(_time) as days by day_of_week
| eval average_count = count / days
| eventstats avg(average_count)
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...