Splunk Search

Search within sub-time range

ghnwmlguy
Explorer

I am trying to collect stats from login events from evening hours. I would like to run reports for any time range (last 60m, 7d, etc.) but only view results that show logons between the hours of 5pm and 7am.

Tags (1)
0 Karma

David
Splunk Employee
Splunk Employee

You can add the following search criteria:

((date_hour > 17) OR (date_hour < 7))

And that should get you where you want to be. Personally, I use:

((date_wday="saturday" OR date_wday="sunday") OR (date_hour < 7 OR date_hour > 17))

You can then toss that in macros.conf like so:

[OffHours]
definition = ((date_wday="saturday" OR date_wday="sunday") OR (date_hour < 7 OR date_hour > 17))
iseval = 0

so you can just add in

`OffHours`

to your searches and have it automatically included.

Get Updates on the Splunk Community!

Expert Tips from Splunk Professional Services, Ensuring Compliance, and More New ...

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

Observability Release Update: AI Assistant, AppD + Observability Cloud Integrations & ...

This month’s releases across the Splunk Observability portfolio deliver earlier detection and faster ...

Stay Connected: Your Guide to February Tech Talks, Office Hours, and Webinars!

&#x1f48c;Keep the new year’s momentum going with our February lineup of Community Office Hours, Tech Talks, ...