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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...