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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...