Getting Data In

Let Dashboard Panel accept multiple time range inputs

sebkue
New Member

I have a global time range input that I set to the token 'globaltime'. In each of my panels I have another time range picker so to the token 'localtime_i' . As a default value the "localtime_i' token is set to 'globaltime'. In the edit dashboard ui, I set the Time Range Scope to the Time Picker of each channel. So changing the local time range for each panel separately, reruns the search for each panel.
However I want to add the option, that if the global time picker is changed, it overrides the local time picker and triggers a new search.

Is it possible to have two time range pickers that are both able to trigger a search for the same panel?

0 Karma

vishaltaneja070
Motivator

This will work for you:

 <form>
      <label>test_db_01</label>
      <fieldset submitButton="false" autoRun="true">
        <input type="time" token="tok_time_01" searchWhenChanged="true">
          <label>Global....$tok_time_01.earliest$</label>
          <default>
            <earliest>-24h@h</earliest>
            <latest>now</latest>
          </default>
          <change>
            <unset token="form.tok_time_02.earliest"></unset>
            <unset token="form.tok_time_02.latest"></unset>
            <set token="form.tok_time_02.earliest">$earliest$</set>
            <set token="form.tok_time_02.latest">$latest$</set>
            <unset token="form.tok_time_03.earliest"></unset>
            <unset token="form.tok_time_03.latest"></unset>
            <set token="form.tok_time_03.earliest">$earliest$</set>
            <set token="form.tok_time_03.latest">$latest$</set>
          </change>
        </input>
      </fieldset>
      <row>
        <panel>
          <title></title>
          <input type="time" token="tok_time_02" searchWhenChanged="true">
            <label>Panel 1...$tok_time_02.earliest$</label>
            <default>
              <earliest>-24h@h</earliest>
              <latest>now</latest>
            </default>
          </input>
          <table>
            <search>
              <query>index=_*| stats count by source</query>
              <earliest>$tok_time_02.earliest$</earliest>
              <latest>$tok_time_02.latest$</latest>
            </search>
            <option name="refresh.display">progressbar</option>
          </table>
        </panel>
        <panel>
          <title></title>
          <input type="time" token="tok_time_03" searchWhenChanged="true">
            <label>Panel 2..$tok_time_03.earliest$</label>
            <default>
              <earliest>-7d@h</earliest>
              <latest>now</latest>
            </default>
          </input>
          <table>
            <search>
              <query>index=_* | stats count by source</query>
              <earliest>$tok_time_03.earliest$</earliest>
              <latest>$tok_time_03.latest$</latest>
            </search>
            <option name="refresh.display">progressbar</option>
          </table>
        </panel>
      </row>
    </form>
0 Karma

maciep
Champion

You can have your main time picker update all of the others with the change handler. here's a simple example.

<form>
  <label>Test</label>
  <fieldset submitButton="false">
    <input type="time" token="t_global_time" searchWhenChanged="true">
      <label>global</label>
      <default>
        <earliest>-15m</earliest>
        <latest>now</latest>
      </default>
      <change>
        <set token="form.t_local.earliest">$earliest$</set>
        <set token="form.t_local.latest">$latest$</set>
      </change>
    </input>
  </fieldset>
  <row>
    <panel>
      <input type="time" token="t_local" searchWhenChanged="true">
        <label>local</label>
        <default>
          <earliest>-60m@m</earliest>
          <latest>now</latest>
        </default>
      </input>
      <table>
        <search>
          <query>| tstats count where index=_internal by sourcetype</query>
          <earliest>$t_local.earliest$</earliest>
          <latest>$t_local.latest$</latest>
        </search>
      </table>
    </panel>
  </row>
</form>

santosh_sshanbh
Path Finder

Your comments above helped me to solve my issue posted at
https://answers.splunk.com/answers/794801/pass-time-input-value-as-default-to-another-time-i.html

Thanks for the response.

0 Karma
Get Updates on the Splunk Community!

.conf25 Registration is OPEN!

Ready. Set. Splunk! Your favorite Splunk user event is back and better than ever. Get ready for more technical ...

Detecting Cross-Channel Fraud with Splunk

This article is the final installment in our three-part series exploring fraud detection techniques using ...

Splunk at Cisco Live 2025: Learning, Innovation, and a Little Bit of Mr. Brightside

Pack your bags (and maybe your dancing shoes)—Cisco Live is heading to San Diego, June 8–12, 2025, and Splunk ...