I have a dashboard with multiple panels each requiring their separate time inputs. But, the dashboard also needs a common time input.
So, the requirements are
Here is the Dashboard XML that I am currently using but its's not giving me what I need.
<form>
<label>EDTC Reporting</label>
<description>EDTC requirements for new application</description>
<fieldset submitButton="false" autoRun="true">
<input type="time" token="field1" searchWhenChanged="true">
<label></label>
<default>
<earliest>0</earliest>
<latest>now</latest>
</default>
</input>
</fieldset>
<row>
<panel>
<input type="time" token="time1" searchWhenChanged="true">
<label></label>
<default>
<earliest>$field1.earliest$</earliest>
<latest>$field1.latest$</latest>
</default>
</input>
<chart>
<title>Average Response Time per Module</title>
<search>
<query>index=main
| rex field=processingTime "\[(?<responseTime>\d*)"
| stats avg(responseTime) by module</query>
<earliest>$time1.earliest$</earliest>
<latest>$time1.latest$</latest>
</search>
<option name="charting.axisTitleX.text">Module</option>
<option name="charting.axisTitleY.text">Average Response Time</option>
<option name="charting.axisY.scale">linear</option>
<option name="charting.chart">column</option>
<option name="charting.chart.stackMode">default</option>
<option name="charting.drilldown">none</option>
</chart>
</panel>
</row>
<row>
<panel>
<input type="time" token="time2" searchWhenChanged="true">
<label></label>
<default>
<earliest>$field1.earliest$</earliest>
<latest>$field1.latest$</latest>
</default>
</input>
<chart>
<title>Module wise Error Rate</title>
<search>
<query>index=main
| where isnotnull(errorCode)
| stats count as count2 by module
| join type=inner module
[
search index=main
| stats count as count1 by module
]
| eval errorRate = (count2/count1*100)
| table module errorRate</query>
<earliest>$time2.earliest$</earliest>
<latest>$time2.latest$</latest>
</search>
<option name="charting.axisTitleY.text">Error Rate</option>
<option name="charting.axisY.maximumNumber">100</option>
<option name="charting.axisY.minimumNumber">0</option>
<option name="charting.chart">column</option>
<option name="charting.drilldown">none</option>
<option name="refresh.display">progressbar</option>
</chart>
</panel>
</row>
<row>
<panel>
<input type="time" token="time3" searchWhenChanged="true">
<label></label>
<default>
<earliest>$field1.earliest$</earliest>
<latest>$field1.latest$</latest>
</default>
</input>
<chart>
<title>Module wise Security Exceptions</title>
<search>
<query>index=main
| where match(displayMessage,"Resource Unavailable")
| stats count by module</query>
<earliest>$time3.earliest$</earliest>
<latest>$time3.latest$</latest>
</search>
<option name="charting.chart">column</option>
<option name="charting.drilldown">none</option>
</chart>
</panel>
</row>
<row>
<panel>
<input type="time" token="time4" searchWhenChanged="true">
<label></label>
<default>
<earliest>$field1.earliest$</earliest>
<latest>$field1.latest$</latest>
</default>
</input>
<table>
<title>Unique Users</title>
<search>
<query>index=main
| dedup unique_name
| table unique_name</query>
<earliest>$time4.earliest$</earliest>
<latest>$time4.latest$</latest>
</search>
<option name="drilldown">none</option>
<option name="refresh.display">progressbar</option>
</table>
</panel>
</row>
<row>
<panel>
<input type="time" token="time5" searchWhenChanged="true">
<label></label>
<default>
<earliest>$field1.earliest$</earliest>
<latest>$field1.latest$</latest>
</default>
</input>
<table>
<title>Most Used Features</title>
<search>
<query>index=main
| dedup _raw
| top limit=10 path</query>
<earliest>$time5.earliest$</earliest>
<latest>$time5.latest$</latest>
</search>
<option name="drilldown">none</option>
</table>
</panel>
</row>
<row>
<panel>
<input type="time" token="time6" searchWhenChanged="true">
<label></label>
<default>
<earliest>$field1.earliest$</earliest>
<latest>$field1.latest$</latest>
</default>
</input>
<table>
<title>Least Used Feature</title>
<search>
<query>index=main
| dedup _raw
| rare limit=10 path</query>
<earliest>$time6.earliest$</earliest>
<latest>$time6.latest$</latest>
</search>
<option name="drilldown">none</option>
</table>
</panel>
</row>
</form>
And, below shown is what I get when I first open the dashboard.
Add this in your XML after the <description> element in the first few lines and remove all the timeX <default> settings.
<search>
<query>
| makeresults
| addinfo
| eval info_max_time=if(info_max_time="+Infinity", "now", info_max_time)
</query>
<done>
<set token="time1.earliest">$result.info_min_time$</set>
<set token="time1.latest">$result.info_max_time$</set>
<set token="time2.earliest">$result.info_min_time$</set>
<set token="time2.latest">$result.info_max_time$</set>
<set token="time3.earliest">$result.info_min_time$</set>
<set token="time3.latest">$result.info_max_time$</set>
<set token="time4.earliest">$result.info_min_time$</set>
<set token="time4.latest">$result.info_max_time$</set>
<set token="time5.earliest">$result.info_min_time$</set>
<set token="time5.latest">$result.info_max_time$</set>
<set token="time6.earliest">$result.info_min_time$</set>
<set token="time6.latest">$result.info_max_time$</set>
</done>
<earliest>$field1.earliest$</earliest>
<latest>$field1.latest$</latest>
</search>
This will work out the start/end time for the default time and then set all the other time tokens for other panels. Then if you change the default, this search will rerun and will set all the panel times, whereas if you change the panel time it will change that panel only.
However, it will not change the UI in the panel for all panel time pickers when you change the default. I believe you will have to write some javascript to do that.
Hope this helps
Add this in your XML after the <description> element in the first few lines and remove all the timeX <default> settings.
<search>
<query>
| makeresults
| addinfo
| eval info_max_time=if(info_max_time="+Infinity", "now", info_max_time)
</query>
<done>
<set token="time1.earliest">$result.info_min_time$</set>
<set token="time1.latest">$result.info_max_time$</set>
<set token="time2.earliest">$result.info_min_time$</set>
<set token="time2.latest">$result.info_max_time$</set>
<set token="time3.earliest">$result.info_min_time$</set>
<set token="time3.latest">$result.info_max_time$</set>
<set token="time4.earliest">$result.info_min_time$</set>
<set token="time4.latest">$result.info_max_time$</set>
<set token="time5.earliest">$result.info_min_time$</set>
<set token="time5.latest">$result.info_max_time$</set>
<set token="time6.earliest">$result.info_min_time$</set>
<set token="time6.latest">$result.info_max_time$</set>
</done>
<earliest>$field1.earliest$</earliest>
<latest>$field1.latest$</latest>
</search>
This will work out the start/end time for the default time and then set all the other time tokens for other panels. Then if you change the default, this search will rerun and will set all the panel times, whereas if you change the panel time it will change that panel only.
However, it will not change the UI in the panel for all panel time pickers when you change the default. I believe you will have to write some javascript to do that.
Hope this helps
Yes, it works as you anticipated. But the non reflection of changes to UI is still a problem. Thank you so much!