Splunk Search

Define time from 6am to 6pm of 1 week

kailun92
Communicator

Hi splunk, I had a search of

sourcetype="ltaTraffic" Type="Accident" tag=expressway earliest=-30d | transaction locationaccident maxspan=1s | bucket span=1h _time | dedup locationaccident| fields onexpressway, locationaccident, current_area | eval date=strftime(_time, "%m/%d/%Y %H:%M:%S") | chart count(locationaccident) as Accidents by date | sort -Accidents | head 25 | sort date

How can I define the time from 6am to 6pm of 1 week ? I know starttime and endtime but it won't work as I am collecting data all the way.

Tags (1)
0 Karma

grijhwani
Motivator

To limit the results to certain hours of the day, construct your search to include the actual hour of the event, and restrict your search accordingly. Thankfully this is a standard default field. Add the following to your basic search clause:

date_hour>=6 date_hour<18

If you wanted a more specific time window things would get distinctly more complex.

Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...