Splunk Search

exclude specific time in all days

indeed_2000
Motivator

Hi

How can I exclude this time range from search 23:55 to 06:00

I'm using below spl but minutes required.

index="my-index"  NOT (date_hour>=23 date_hour<6) 

 

any idea?

Thanks,

0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

and for completeness, rather than using a NOT clause

https://docs.splunk.com/Documentation/Splunk/8.2.2/Search/Quicktipsforoptimization

use

index="my-index" (date_hour>=6 AND (date_hour<23 OR (date_hour=23 date_minute<55)))

not done any detailed comparisons of timings...

 

View solution in original post

bowesmana
SplunkTrust
SplunkTrust

and for completeness, rather than using a NOT clause

https://docs.splunk.com/Documentation/Splunk/8.2.2/Search/Quicktipsforoptimization

use

index="my-index" (date_hour>=6 AND (date_hour<23 OR (date_hour=23 date_minute<55)))

not done any detailed comparisons of timings...

 

richgalloway
SplunkTrust
SplunkTrust

Does this help?

index="my-index"  NOT ((date_hour>=23 date_minute>=55) date_hour<6) 
---
If this reply helps you, Karma would be appreciated.
0 Karma

PickleRick
SplunkTrust
SplunkTrust

Shouldn't work 😉 You can't have a time which has both hour>23 and hour<6. You wrapped the day around midnight 😉

The condition should be

NOT (date_hour>23 date_minute>55) NOT date_hour<6

alternatively

NOT ((date_hour>23 date_minute>55) OR date_hour<6)

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

Splunk is officially part of Cisco

Revolutionizing how our customers build resilience across their entire digital footprint.   Splunk ...

Splunk APM & RUM | Planned Maintenance March 26 - March 28, 2024

There will be planned maintenance for Splunk APM and RUM between March 26, 2024 and March 28, 2024 as ...