Splunk Search

Why is timestamp not showing as the default in column1 when I load the dashboard?

vamsi354
Explorer

Hi Experts , i want to show Column1 timestamp selected as default in Date/Time Range From not sure what i am doing wrong but when i select the different date its updating


<fieldset submitButton="false" autoRun="false">
<input type="time" token="field2" searchWhenChanged="true">
<label>Column 1</label>
<default>
<earliest>1661144400</earliest>
<latest>1661230800</latest>
</default>
<change>
<eval token="timeRangeEarliestearliest">if(isnum($field2.earliest$), $field2.earliest$, relative_time(now(), $field2.earliest$))</eval>
<eval token="timeRangeLatestearliest">if(isnum($field2.latest$), $field2.latest$, relative_time(now(), $field2.latest$))</eval>
<eval token="prettyPrinttimeRangeFromTimeearliest">strftime($timeRangeEarliestearliest$, "%a, %e %b %Y")</eval>
<eval token="prettyPrinttimeRangeToTimeearliest">strftime($timeRangeLatestearliest$, "%a, %e %b %Y")</eval>
</change>
</input>
<input type="time" token="field1" searchWhenChanged="true">
<label>Column 2</label>
<default>
<earliest>@d</earliest>
<latest>now</latest>
</default>
<change>
<eval token="timeRangeEarliestlatest">if(isnum($field1.earliest$), $field1.earliest$, relative_time(now(), $field1.earliest$))</eval>
<eval token="timeRangeLatestlatest">if(isnum($field1.latest$), $field1.latest$, relative_time(now(), $field1.latest$))</eval>
<eval token="prettyPrinttimeRangeFromTimelatest">strftime($timeRangeEarliestlatest$, "%a, %e %b %Y")</eval>
<eval token="prettyPrinttimeRangeToTimelatest">strftime($timeRangeLatestlatest$, "%a, %e %b %Y")</eval>
</change>
</input>
</fieldset>
<row>
<panel>
<html>
<h3>Date/Time Range From</h3>
<table>
<tr>
<td>From:</td>
<td>$prettyPrinttimeRangeFromTimeearliest$</td>
</tr>
<tr>
<td>To:</td>
<td>$prettyPrinttimeRangeToTimeearliest$</td>
</tr>
</table>
</html>
</panel>
</row>
<row>
<panel>
<html>
<h3>Date/Time Range</h3>
<table>
<tr>
<td>From:</td>
<td>$prettyPrinttimeRangeFromTimelatest$</td>
</tr>
<tr>
<td>To:</td>
<td>$prettyPrinttimeRangeToTimelatest$</td>
</tr>
</table>
</html>
</panel>
</row>


vamsi354_0-1661792594851.png

 

Labels (1)
Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

It is to do with the order in which things are executed when the dashboard displays. Try putting this in the init block at the top of the dashboard

<set token="form.field2.earliest">1661144400</set>
<set token="form.field2.latest">1661230800</set>

and remove the default section from the field2 input

vamsi354
Explorer

@ITWhisperer any idea on this

 

0 Karma
Get Updates on the Splunk Community!

Your Voice Matters! Help Us Shape the New Splunk Lantern Experience

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

September Community Champions: A Shoutout to Our Contributors!

As we close the books on another fantastic month, we want to take a moment to celebrate the people who are the ...

Community Content Calendar, October Edition

Welcome to the October edition of our Community Spotlight! The Splunk Community is a treasure trove of ...