Dashboards & Visualizations

Search time range based on epoch token from drilldown, how can I use my epoch token to set the time ranges in my panels?

TalNiv
New Member

I have a dashboard which received a token named "time" by drilldown, which stores a specific time in epoch. 

Now I want the searches in my dashboard to have a time range based on this epoch value. 

I tried to use this token in "earliest" and "latest",  i.e, <earliest>$time$</earliest>.

I worked only when I put the token as is, but not with any kind of simple arithmetic like <earliest>$time$ - 100000 </earliest>.

How can I use my epoch token to set the time ranges in my panels? 

Labels (4)
0 Karma

danspav
SplunkTrust
SplunkTrust

Hi @TalNiv ,

The easiest way is how @gcusello said - update the original dashboard to create two tokens for earliest / latest.

You can add this to the section where you create the $time$ token in the original dashboard:
<eval token="earliest">tonumber($time$) - 10000</eval>

If you don't have access to that dashboard there aren't many options. AFAIK you cannot use URL sourced tokens in the <init> section of your dashboard to do the same eval tag.

One very roundabout way is to create a dummy search, and create tokens off that. E.g. put this at the top of your dashboard under the label section:

<search>
<query>|makeresults | eval earliest=tonumber($time$) - 100000, latest=$time$</query>
<done>
<set token="earliest">$result.earliest$</set>
<set token="latest">$result.latest$</set>
</done>
</search>

Now you can use $earliest$ and $latest$ in your searches.

gcusello
SplunkTrust
SplunkTrust

Hi @TalNiv,

in the main dashboard create two fields earliest and latest (both in epochtime) and then pass them in drilldown.

Ciao.

Giuseppe

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 ...