My Splunk dashboard contains a timepicker along with a search results panel which displays a table output. The dashboard can be accessed by passing a input parameter 'form.queryParam.earliest' from another dashboard. Or it can directly be accessed independently without passing a parameter.
The expected behavior is:
With this in mind, I configured it with the following.
<form>
<label>Test Dashboard</label>
<fieldset submitButton="false" autoRun="true">
<input type="time" token="selectedTimestamp" searchWhenChanged="true">
<label>Time</label>
<default>
<earliest>-1d@d</earliest>
<latest></latest>
</default>
<change>
<set token="timeChanged">true</set>
</change>
</input>
</fieldset>
<!-- DUMMY SEARCH TO EVALUATE FINAL VALUE BASED ON CONDITIONS -->
<search>
<query>| makeresults</query>
<earliest>-1s@s</earliest>
<latest>now</latest>
<done>
<eval token="finalEarliest">case(isnotnull($timeChanged$), $form.selectedTimestamp.earliest$, isnotnull($form.queryParam.earliest$), $form.queryParam.earliest$, true(), $form.selectedTimestamp.earliest$)</eval>
</done>
</search>
<!-- ACTUAL SEARCH -->
<row>
<panel>
<title>Results Tale</title>
<table>
<search>
<query>ACTUAL QUERY</query>
<earliest>$finalEarliest$</earliest>
<latest>now</latest>
</search>
<option name="link.exportResults.visible">0</option>
<option name="link.inspectSearch.visible">0</option>
<option name="link.openPivot.visible">0</option>
<option name="link.openSearch.visible">0</option>
<option name="refresh.link.visible">0</option>
<format type="color" field="percent_of_total_count">
<colorPalette type="list">[#65A637,#6DB7C6,#F7BC38,#F58F39,#D93F3C]</colorPalette>
<scale type="threshold">0,30,70,100</scale>
</format>
</table>
</panel>
</row>
</form>
I am having 2 problems with this.
Can someone please help.
Regards.
Seem like you may be over complicating this a bit? Why not just pass the actual timepicker values in the URL from the other dashboard? Something like this?
form.selectedTimestamp.earliest=-5d&form.selectedTimestamp.latest=now
And just set your search to use the timepicker's values?
<earliest>$selectedTimestamp.earliest$</earliest>
<latest>$selectedTimestamp.latest$</latest>
Thanks maciep for the reply.
This helps. Although, one scenario is still open. The child dashboard can also be accessed directly, in which case I want to set defaults for the earliest and latest values of the timepicker. Can you please suggest?
Thanks
what part of that doesn't work currently? The timepicker in the child dashboard would have the default range configured, right? So if you go there manually, without populating anything in the url, then it should use those defaults.