Splunk Search

timechart only business hours

peter_gianusso
Communicator

I would like to timechart only events that happened between 9 AM and 5 PM...any help would be appreciated

0 Karma
1 Solution

somesoni2
Revered Legend

Try something like this

If date_hour is available in your data

your search  date_hour>=9 AND date_hour<17 | your timechart command

If date_hour is not present,

your search | eval date_hour=strftime(_time,"%H") | where  date_hour>=9 AND date_hour<17 | your timechart command

View solution in original post

jkat54
SplunkTrust
SplunkTrust

Hi,

You need a where clause using date_hour, and then you'll probably want to increase the bins, or use the bucket command to help show time periods when there isnt data:

 index=_internal | where date_hour>=9 AND date_hour<=17 | timechart count bins=1000

alt text

peter_gianusso
Communicator

thank you!!

0 Karma

somesoni2
Revered Legend

Try something like this

If date_hour is available in your data

your search  date_hour>=9 AND date_hour<17 | your timechart command

If date_hour is not present,

your search | eval date_hour=strftime(_time,"%H") | where  date_hour>=9 AND date_hour<17 | your timechart command

jkat54
SplunkTrust
SplunkTrust

if i hadnt taken the screenshot... ;-P, you beat me to it by 25s!

0 Karma

peter_gianusso
Communicator

thank you!!

0 Karma
Get Updates on the Splunk Community!

Enter the Splunk Community Dashboard Challenge for Your Chance to Win!

The Splunk Community Dashboard Challenge is underway! This is your chance to showcase your skills in creating ...

.conf24 | Session Scheduler is Live!!

.conf24 is happening June 11 - 14 in Las Vegas, and we are thrilled to announce that the conference catalog ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...