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!

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 ...