Splunk Search

Searching for results during business hours and after-hours?

emile194
New Member

My customer wants a count of calls coming into their call center during their business hours (M, Tu, Th, F: 8:00 a.m. - 4:30 p.m. and W: 9:00 a.m. - 4:30 p.m.) and a count of calls that come in outside these hours and on weekends. This is what I have for the time element of the after-hours search so far, but I am getting no results:

| eval date_hour=strftime(_time, "%H") | eval date_wday = strftime(_time, "%w")
| search (date_wday=1 OR date_wday=2 OR date_wday=4 OR day_wday=5 date_hour<=7 date_hour>=17.5) OR (date_wday=3 date_hour<=8 date_hour>=17.5) OR (date_wday=6 OR date_wday=7)
Labels (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @emile194,

there's one my ansewer to a similar question at https://community.splunk.com/t5/Splunk-Search/How-to-write-query-for-including-non-business-hours-an...

Your solution is correct but it doesn't manage holydays.

If you want also to manage holydays, you need to create a lookup containing all the dates of the year and a code for holyday, full working, half working.

Ciao.

Giuseppe

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...