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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...