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!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...