Dashboards & Visualizations

Pass Time input value as default to another time input

santosh_sshanbh
Path Finder

I have 2 Time inputs on a single dashboard. MY requirement is to pass the value selected for 1st Time input as a default value for 2nd Time input. I tried to use $First_Time.earliest$ for the earliest parameter of 2nd time input but nothing is working for me.

Is there any way to achieve this?

0 Karma

santosh_sshanbh
Path Finder

skoelpin
SplunkTrust
SplunkTrust

Pass the token inline of the search like this

index=... earliest=$First_Time.earliest$ latest=$First_Time.earliest$
0 Karma

santosh_sshanbh
Path Finder

Basically I have a dril down functionality on my dashboard. The first Time input will be visible at load. And 2nd will be visible on drill down. And the default value for 2nd Time input I want to pass the current selected value for 1st Time input.

The drill down search is tied to earliest and latest time range of 2nd Time input.

0 Karma

dmarling
Builder

The below xml will accomplish this on initial page load, but after that it's all bets are off. I don't really understand why you need to do this but it will work:

<form>
  <label>Double Time inputs</label>
  <fieldset submitButton="false">
    <input type="time" token="timetok1">
      <label>time input 1</label>
      <default>
        <earliest>-7d@w0</earliest>
        <latest>@w0</latest>
      </default>
    </input>
    <input type="time" token="timetok2">
      <label></label>
      <default>
        <earliest>$timetok1.earliest$</earliest>
        <latest>$timetok1.latest$</latest>
      </default>
    </input>
  </fieldset>
</form>

On page load it will default the second time input with whatever is in the first time input as long as you don't have the second token timetok2 in the url. If you change the first time input after that point or if you have the timetok2 defined in the url as anything other than form.timetok2.earliest=%24timetok1.earliest%24&form.timetok2.latest=%24timetok1.latest%24, it will ignore whatever is in the first time field.

If this comment/answer was helpful, please up vote it. Thank you.
0 Karma

santosh_sshanbh
Path Finder

This approach I have tried and its not working. I have extended your code by adding a panel to show count of events by sourcetypes. However, I am getting error ' Invalid earliest_time.' at load as well as when date time changes in input 1.

Double Time inputs

<input type="time" token="timetok1">
  <label>time input 1</label>
  <default>
    <earliest>-7d@w0</earliest>
    <latest>@w0</latest>
  </default>
</input>
<input type="time" token="timetok2">
  <label>time input 2</label>
  <default>
    <earliest>$timetok1.earliest$</earliest>
    <latest>$timetok1.latest$</latest>
  </default>
</input>


<panel>
  <table>
    <search>
      <query>index=* | stats count(8) by sourcetype</query>
      <earliest>$timetok2.earliest$</earliest>
      <latest>$timetok2.latest$</latest>
    </search>
    <option name="drilldown">none</option>
    <option name="refresh.display">progressbar</option>
  </table>
</panel>
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Maximizing the Value of Splunk ES 8.x

Splunk Enterprise Security (ES) continues to be a leader in the Gartner Magic Quadrant, reflecting its pivotal ...