Splunk Search

Dynamic query to get the result in specific timeframe for any days

anirban_nag
Explorer

I have a specific timeframe say from 1AM to 2AM. In this 1 hour I want to see all the failures from my log. But I want to see this timeframe failures not for only today but for N no of days. This N will be specified from the Date Range dropdown.

Bouns point if I can get the result for each day in a column chart side by side.

Tags (2)
0 Karma
1 Solution

inventsekar
SplunkTrust
SplunkTrust

we can use date_hour and solve this specific timeframe issue.
Try this one -

 index=main sourcetype=yourSourcetype earliest=-31d latest=-1d (date_hour > 1 OR date_hour < 2) | chart count(Failure) by sourcetype over host

View solution in original post

inventsekar
SplunkTrust
SplunkTrust

we can use date_hour and solve this specific timeframe issue.
Try this one -

 index=main sourcetype=yourSourcetype earliest=-31d latest=-1d (date_hour > 1 OR date_hour < 2) | chart count(Failure) by sourcetype over host
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...