Splunk Search

How to compare data between two business weeks using time chart excluding weekends?

Devi13
Path Finder

Hello Team,

Could you please suggest on how to create an overlapping graph which compares this week's data and previous week's data excluding weekends.

Any help is very much appreciated.

My base search is very simple.
index=my index source=/.log '#search string#'
| time chart span=1h count(_raw) by host

 

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Repeat the first two lines - timechart adds the times back in, but the good thing about it is that if there are any hours without any events, you still get zeroes for those hours. If you use chart or stats instead, the times without events don't appear at all.

View solution in original post

0 Karma

Devi13
Path Finder

Greatt! Thank you so muchh for your help 🙂

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| eval day= strftime(_time,"%w")
| where day > 0 AND day < 6
| timechart span=1h count by host
| timewrap 1w align=end

Devi13
Path Finder

Hello, 

Thank you so so much , it works like a charm.

But I still get weekends in the results, is there a way to exclude them?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Repeat the first two lines - timechart adds the times back in, but the good thing about it is that if there are any hours without any events, you still get zeroes for those hours. If you use chart or stats instead, the times without events don't appear at all.

0 Karma
Get Updates on the Splunk Community!

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Index This | What goes away as soon as you talk about it?

May 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...

What's New in Splunk Observability Cloud and Splunk AppDynamics - May 2025

This month, we’re delivering several new innovations in Splunk Observability Cloud and Splunk AppDynamics ...