Dashboards & Visualizations

Show Label of selected time range in drilldown dashboard

tdoSplunk
Path Finder

Hi,

we want to display the selected time range in another dashboard (via drilldown). We already use the $earliest$ and $latest$ so that we can display the time range with "from" "to".
Our goal is now to display the label of the selected time range in the second dashboard as well. e.g. "Last 7 Days" or "Current Year"

I already set an eval to calculate the duration

<eval token="diff">tostring((tokLatestTime - tokEarliestTime), "duration")</eval>
<eval token="durationStr">tostring(floor(diff))</eval>

but it is not really what we are looking for.

Step by step:
1) Choose time range in Dashboard 1 --> e.g. Last 7 Days
2) Click on table --> Drilldown via link

 <drilldown>
       <link target="_blank">/app/myapp/dashboard2?earliest=$earliest$&amp;latest=$latest$&amp;TimeLabel=????</link>
 </drilldown>

3) Show TimeLabel on Dashboard2

Do you have an idea how to get this label?

best regards
Thomas

0 Karma

vnravikumar
Champion

Hi

Try this

<form>
  <label>dashboard1</label>
  <fieldset submitButton="false">
    <input type="time" token="timepicker">
      <label></label>
      <default>
        <earliest>-24h@h</earliest>
        <latest>now</latest>
      </default>
      <change>
        <set token="timelabel">$label$</set>
      </change>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <search>
          <query>index="_internal" |stats count by host</query>
          <earliest>$timepicker.earliest$</earliest>
          <latest>$timepicker.latest$</latest>
        </search>
        <option name="count">10</option>
        <option name="drilldown">cell</option>
        <drilldown>
          <link target="_blank">/app/search/dashboard2?timelabel=$timelabel$</link>
        </drilldown>
      </table>
    </panel>
  </row>
</form>


<dashboard>
  <label>dashboard2</label>
  <row>
    <panel>
      <table>
        <title>$timelabel$</title>
        <search>
          <query>index="_internal" |stats count by host</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="count">10</option>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>
</dashboard>
0 Karma

tdoSplunk
Path Finder

Hi,

thanks for your response. It works nearly perfect. But in some cases e.g. "Current Year" or "Today" the label shows "Custom Time". Is that a normal behaviour?
best regards
Thomas

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