Dashboards & Visualizations

How to have dynamic time range selection for different panels?

sarahnazzar
Explorer

I've a form with different panels, there I have added a time range picker which will be the time input for some panels, but for some particular panels, based on my time input it should automatically check for last 7 days data. So based on the main time range selection it must assign time put to the particular panels.

For instance, if I give 4/30/2019 as my input in time picker then the time range for some panels should it assigned in such a way so that it checks for last 7 days data i.e (from 4/23/2019 to 4/30/2019) in those particular panels when the time token is passed.

Thanks in Advance!

0 Karma

vnravikumar
Champion

Hi

Give a try

<form>
  <label>timepicker</label>
  <fieldset submitButton="false">
    <input type="time" token="timepicker">
      <label></label>
      <default>
        <earliest>-24h@h</earliest>
        <latest>now</latest>
      </default>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <search>
          <query>index="_internal" |stats count by source</query>
          <earliest>$timepicker.earliest$</earliest>
          <latest>$timepicker.latest$</latest>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>
  <row>
    <panel>
      <table>
        <search>
          <query>index="_internal" |stats count by source ,_time</query>
          <earliest>-7d@d</earliest>
          <latest>$timepicker.latest$</latest>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>
0 Karma

sarahnazzar
Explorer

Thanks for the reply!
Tried this but I'm getting the below error while selecting custom time.. This one is not working for custom time input.

Invalid latest_time: latest_time must be after earliest_time.

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...