Splunk Search

How to narrow down data with time?

Chris231289
Loves-to-Learn Lots

Hello, 

i am looking to narrow down my search field, i only want to search for events that happen outside of  a specific time range. I want to search for events that happen outside of 0800 to 1700

Any help would be appriceated 

Kind regards 

Labels (1)
0 Karma

yeahnah
Motivator

Hi @Chris231289 

It's useful for these types of queries to understand where the events to be filtered come from and how they look.  It also may depend on where you need to filter the data, has it been transformed into a summary already.  These things can make a difference to how you would filter out events. 

If this is standard search query then by default Splunk creates a data_hour field (from the _time field) so something like this would work...

...your base query search query...
| where ((date_hour < 8 OR (date_hour >= 17))

Maybe provide a sample of you data or your current search query if this does not work for you. 
 
Hope this helps.

0 Karma

Chris231289
Loves-to-Learn Lots

thank you but when i put in | where((date_hour < 8 OR (date_hour >= 17))  i get the error Error in 'where' command: The expression is malformed. Expected ).

0 Karma

yeahnah
Motivator

Looks like i missed the closing parenthesis after the 8.  Try...
 
| where  ((date_hour < 8 ) OR (date_hour >= 17))

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!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...