Dashboards & Visualizations

Time Picker in the Dashboard not working as expected.

Path Finder

We have a dashboard . When we select time period say 11/13/19 (9 am to 11 am ). The results are displying from 11/13/19 (8 am to 10 am) and the results consist of all zeros in between 8 to 9 am where there are values from 9 to 10 am . I think the zeros are diplaying because it's not the correct time. I don't think it's a timezone issue. How can we fix time picker for the dashboard so that it will only displays the results for selected time period(8 am 10 am) with no zeros?
Here are the tokens used for the source code

 <eval token="earliestTime">if(isstr(earliest), relative_time(now(),earliest), earliest)</eval>
 <eval token="latestTime">if(isstr(latest), relative_time(now(),latest), latest)</eval>
 <eval token="earliestTime1">relative_time(earliestTime,"-7d")</eval>
 <eval token="latestTime1">relative_time(latestTime,"-7d")</eval>
 <eval token="earliestTime2">relative_time(earliestTime,"-14d")</eval>
 <eval token="latestTime2">relative_time(latestTime,"-14d")</eval>
 <eval token="earliestTime3">relative_time(earliestTime,"-21d")</eval>
 <eval token="latestTime3">relative_time(latestTime,"-21d")</eval>
 <eval token="earliestTime4">relative_time(earliestTime,"-28d")</eval>
 <eval token="latestTime4">relative_time(latestTime,"-28d")</eval> 
0 Karma

Esteemed Legend

Your approach seems very strange to me but in any case, you are missing dollar-signs, so like this:

<eval token="earliestTime">if(isstr(earliest), relative_time(now(),earliest), earliest)</eval>
<eval token="latestTime">if(isstr(latest), relative_time(now(),latest), latest)</eval>
<eval token="earliestTime1">relative_time($earliestTime$,"-7d")</eval>
<eval token="latestTime1">relative_time($latestTime$,"-7d")</eval>
<eval token="earliestTime2">relative_time($earliestTime$,"-14d")</eval>
<eval token="latestTime2">relative_time($latestTime$,"-14d")</eval>
<eval token="earliestTime3">relative_time($earliestTime$,"-21d")</eval>
<eval token="latestTime3">relative_time($latestTime$,"-21d")</eval>
<eval token="earliestTime4">relative_time($earliestTime$,"-28d")</eval>
<eval token="latestTime4">relative_time($latestTime$,"-28d")</eval> 
0 Karma


Have you played around with relative time modifiers such as @h? https://docs.splunk.com/Documentation/Splunk/8.0.0/SearchReference/SearchTimeModifiers#Searching_the...

In this sense, you can have everything snap to the nearest hour, for example:


will snap to 7 PM whether you run this at 8:02 PM or 8:47 PM.

0 Karma

Path Finder

@aberkow, Thank you for your response.
1)Do you mean I need to update the tokens as below?
if(isstr(earliest), relative_time(now(),"-h@h"earliest), earliest)
if(isstr(latest), relative_time(now(),"-h@h"latest), latest)
2) When you say if we run the search 8:02 PM or 8:47 PM will snap it to 7 PM. Can't we fix the dashboard/time picker to take specific time. In our case 9am to 11 am
Please Advise

0 Karma
Get Updates on the Splunk Community!

Streamline Data Ingestion With Deployment Server Essentials

REGISTER NOW!Every day the list of sources Admins are responsible for gets bigger and bigger, often making the ...

Remediate Threats Faster and Simplify Investigations With Splunk Enterprise Security ...

REGISTER NOW!Join us for a Tech Talk around our latest release of Splunk Enterprise Security 7.2! We’ll walk ...

Introduction to Splunk AI

WATCH NOWHow are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. ...