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 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...