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!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...