Dashboards & Visualizations

Is it possible to reuse the tokens from the timerangepicker later in a form?

HeinzWaescher
Motivator

Hi,

I'm wondering whether it is possible to reuse the tokens from the timerangepicker in a form.

  1. The panels interacts as usual when the timerangepicker is used
  2. In a later pipe I would like to reuse the chosen time tokens from the timerangepicker (earliest & latest) for another calculated field (!= _time).

Is that possible?
thanks in advance

0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi HeinzWaescher,
yes, it's possible, if your Time Picker Token is called "Time", you can use $Time.earliest$ and $Time.latest$ as usual tokens.
Bye.
Giuseppe

View solution in original post

gcusello
SplunkTrust
SplunkTrust

Hi HeinzWaescher,
yes, it's possible, if your Time Picker Token is called "Time", you can use $Time.earliest$ and $Time.latest$ as usual tokens.
Bye.
Giuseppe

HeinzWaescher
Motivator

Awesome, that's something I hoped for. This will make things a lot easier 🙂
Thanks

0 Karma

HeinzWaescher
Motivator

I recognized that this can't handle relative times used in the timerange picker. Earliest and latest are not converted into epochtime.

For example this results in:

| search creation_ts>=-2w@w1 AND creation_ts<=@d

Can we solve these cases directly in this search pipe? Or the best solution to tell dashboard users only to select date ranges?

0 Karma

HeinzWaescher
Motivator

I found an answer that seems to help here:
Like:

| where creation_ts< [|gentimes start=-1 | addinfo | eval search=info_max_time | table search]

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi HeinzWaescher,
if you display earliest and latest in a dashboard, you see that they are displayed in epochtime.
To use in search, use the where command instead search and use brackets:

| where creation_ts>="$Time.earliest$" AND creation_ts<="$Time.latest$"

Bye.
Giuseppe

0 Karma

HeinzWaescher
Motivator

Hm, I'm still facing the problem.

Used timerangepicker: -2w@w1 to @d

My search filter is:

| where creation_ts>="$Timer.earliest$" AND creation_ts<="$Timer.latest$"

Doing a stats afterwards it shows:
man(creation_ts)=2016-12-14 (this should not be possible after there where command)
max(creation_ts)=2017-08-01

When I open the finalized search from the panel, there where clause is shown as:
| where creation_ts>="-2w@w1" AND creation_ts<="@d"

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...