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!

Enterprise Security Content Update (ESCU) | New Releases

In the last month, the Splunk Threat Research Team (STRT) has had 2 releases of new security content via the ...

Announcing the 1st Round Champion’s Tribute Winners of the Great Resilience Quest

We are happy to announce the 20 lucky questers who are selected to be the first round of Champion's Tribute ...

We’ve Got Education Validation!

Are you feeling it? All the career-boosting benefits of up-skilling with Splunk? It’s not just a feeling, it's ...