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!

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...

Stay Connected: Your Guide to October Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...