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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Observability Simplified: Combining User Experience, Application Performance & ...

Tech Talk Observability Simplified: Combining User Experience, Application Performance & Network ...

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...