Dashboards & Visualizations

How to address to the selected timerange in a form search?

iKate
Builder

Hi everyone,

My form view (in simplified XML) consists of a main search that uses major timerange from the dropdown (<input type="time" />) and several joined searches that should have another timeranges that should contain either the start date of major timerange or the end date.

I've tried to use in joined searches statements like: ..| join [search source="first" earliest="$search.timeRange.latest$" latest=now..] but it is written that Invalid value "$search.timeRange.earliest$" for time term 'earliest'

How one can address to the selected timerange dates in simple form search?

Thanks in advance

P.S. @nick, I saw your answer on a similar question(http://splunk-base.splunk.com/answers/22708/how-to-pass-on-the-selected-timerange-in-timerangepicker...), maybe you would be able to help also with this case? I would appreciate it greatly

Tags (2)
0 Karma

woodcock
Esteemed Legend

You might also make use of addinfo but I think this example will show you all you need:

<form>
  <label>Different Times inside Search</label>
  <description>Answers.Splunk.com</description>
  <fieldset autoRun="true" submitButton="false">
    <input type="time" token="time_tok1" searchWhenChanged="true">
      <label>Chart Timespan/Width</label>
      <default>Yesterday</default>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <title>Example of different time token uses</title>
        <search>
          <query>index=* | stats earliest(_time) latest(_time)
            | append [search earliest=-2d@d index=* latest=$time_tok1.latest$ | stats earliest(_time) latest(_time)]
            | append [search earliest=$time_tok1.earliest$ latest=now() index=* | stats earliest(_time) latest(_time)]</query>
          <earliest>$time_tok1.earliest$</earliest>
          <latest>$time_tok1.latest$</latest>
        </search>
        <option name="list.drilldown">full</option>
        <option name="list.wrap">1</option>
        <option name="maxLines">5</option>
        <option name="raw.drilldown">full</option>
        <option name="rowNumbers">false</option>
        <option name="table.drilldown">all</option>
        <option name="table.wrap">1</option>
        <option name="type">list</option>
        <option name="wrap">true</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">cell</option>
        <option name="count">100</option>
      </table>
    </panel>
  </row>
</form>
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 ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...