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.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

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

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...