Dashboards & Visualizations

How to pass a token to a Timepicker?

gcusello
SplunkTrust
SplunkTrust

Hi at all,

I have to pass earliest and latest values from a form to another one by drilldown, but in the second form I have a TimePicker.

I'm able to do this putting earliest and latest tokens in drilldown URL, but this works only if I directly put tokens in a search of the second form (as the following example):

  <!--<search>
      <query>tag=HB ....</query>
      <earliest>$TimeFrom$</earliest>
      <latest>$TimeTo$</latest>
    </search>-->

where $TimeFrom$ and $TimeTo$ are my tokens.

But if I put these Tokens in the TimePicker (see following example):

  <!--<input type="time" token="TimeDet" searchWhenChanged="true">
    <label></label>
    <default>
      <earliest>$TimeFrom$</earliest>
      <latest>$TimeTo$</latest>
    </default>
  </input>-->

and I put TimeDet Tokens in the search, it doesn't work.

It's like the TimePicker doesn't recognize the Tokens I passed.

Anyone has an idea how to solve this problem?

Thank you in advance.

Bye.

Giuseppe

behudelson
Path Finder

Just in case anyone is still seeking an answer to this question. somesoni2 is partially correct. Configure your link as follows:

......
<link>
<![CDATA[/app/search/seconddashboard?form.sourcetype=$click.name2$&form.field1.earliest=$earliest$&form.field1.latest=$latest$]]>
</link>
......

In the link above the token name is the same name as the token name in the destination dashboard. In this case, it is using the default names.

If you then configure your destination dashboard panels to use the Shared Time Picker (field1), the panels will load with the intended values. You should not have to change any Simple XML markup on the destination page for this to work.

0 Karma

somesoni2
SplunkTrust
SplunkTrust

Try something like this

On your Base Dashboard

......
       <link>
             <![CDATA[
  /app/search/seconddashboard?form.sourcetype=$click.name2$&form.TimeDet.earliest=$earliest$&form.TimeDet.latest=$latest$
]]>
  </link>
        </drilldown>
......

On your drilldown dashboard

...
 <input type="time" token="TimeDet">
      <label>Select Time</label>
      <default>
        <earliest>-15m</earliest>
        <latest>now</latest>
      </default>
    </input>
....
<row>
    <panel>
      <chart>
        <search>
          <query>...Your Search....</query>
          <earliest>$TimeDet.earliest$</earliest>
          <latest>$TimeDet.latest$</latest>
        </search>
......

gcusello
SplunkTrust
SplunkTrust

No, in this way the second form doesn't take tokens.
Thank you.
Giuseppe

0 Karma

gcusello
SplunkTrust
SplunkTrust

Putting, as you suggested:
- "form.TimeDet.earliest=$earliest$&form.TimeDet.latest=$latest$" in the link of the first form
- "-15m" and "now" in the TimePicker defaults of the second form
- "$form.TimeDet.earliest$" and "$form.TimeDet.latest$" in the query default of the second form
the second form take the time default of the TimePicker.
In other words my form doesn't take Tokens.

Instead putting "$token_name.earliest$" and "$token_name.latest$" also in the TimePicker default, panels say " Invalid earliest_time"
In other words Tokens time format isn't recognized by the form.

Thank you.

Bye.

Giuseppe

0 Karma

rvany
Communicator

Did you ever get this solved? Or are tokens just not allowed in the time picker's earliest and latest defaults?

0 Karma

chimell
Motivator

Hi

You must use the same token_name in each search tag
look at an example:

        <search>
           <query>...Your Search....</query>
           <earliest>$token_name.earliest$</earliest>
           <latest>$token_name.latest$</latest>
         </search>
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 ...

March Community Office Hours Security Series Uncovered!

Hello Splunk Community! In March, Splunk Community Office Hours spotlighted our fabulous Splunk Threat ...

Stay Connected: Your Guide to April Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars in April. This post ...