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 (2)
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!

2024 Splunk Career Impact Survey | Earn a $20 gift card for participating!

Hear ye, hear ye! The time has come again for Splunk's annual Career Impact Survey!  We need your help by ...

Optimize Cloud Monitoring

  TECH TALKS Optimize Cloud Monitoring Tuesday, August 13, 2024  |  11:00AM–12:00PM PST   Register to ...

What's New in Splunk Cloud Platform 9.2.2403?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.2.2403! Analysts can ...