Splunk Search

Need help to create search for the same time over days

Path Finder


I am running this simple search from 12pm to 2pm:

index=ssn sourcetype=app-gmr eventtype=start_job | stats count
30,634 events (2/8/17 12:00:00.000 PM to 2/8/17 2:00:00.000 PM)

I need to generate average of count of the same time but every day past 7 days.

I was able to do this search using:

index=ssn sourcetype=app-gmr eventtype=start_job earliest=@d-7d latest=@d | where date_hour>11 AND date_hour<15| stats count by date_hour | eval avgjobs=count/7

alt text

But it is really hard to define the parameters in a dropdown list or timerpick in a Dashboard.

Is there a better option? I want to build a dashboard where the user can select the hours and the amount of days for the average, using the search I built is difficult to operate with date_hour, if the user selects for example 2h starting at 11pm.

Thank you,

Tags (1)
0 Karma

Splunk Employee
Splunk Employee

timewrap command is baked into 6.5, or see app on splunkbase for pre6.5. You could use that to get your timeseries, then let user set the span using dashboard inputs.

alt text

index=_internal host=n00bserver
| timechart span=5m count by host
| timewrap d


- MattyMo


May be you can give two drop downs? One for the starting hour and one for the ending hour? You don't have to worry about the duration that way.

0 Karma

Path Finder

Yes I can, it is not about the duration, it is the "method" I used to pick the hours in the day:

where date_hour>11 AND date_hour<15

Let's say the user pick 11pm to 1am (that is 2 hours of data per day during 7 days)

The "equation" will be:

where date_hour>22 AND date_hour<3

That will return 0 always.

0 Karma
Get Updates on the Splunk Community!

Observability | How to Think About Instrumentation Overhead (White Paper)

Novice observability practitioners are often overly obsessed with performance. They might approach ...

Cloud Platform | Get Resiliency in the Cloud Event (Register Now!)

IDC Report: Enterprises Gain Higher Efficiency and Resiliency With Migration to Cloud  Today many enterprises ...

The Great Resilience Quest: 10th Leaderboard Update

The tenth leaderboard update (11.23-12.05) for The Great Resilience Quest is out &gt;&gt; As our brave ...