Splunk Search

how to subtract timepicker's (Number of days) from bar chart's click.value?

sanjum01
Explorer

Hi Folks,

I have below requirement,

I have a dashboard where I have timepicker with token and and bar chart panel. so lets see if i choose 15days

from timepicker it shows data in15 bars (Oct 20th to Nov 3rd). so now lets suppose I click on a bar

($click.value$) it takes me to next panel where I want to see the data from $click.value$ to 15 PREVIOUS days.

e.g if i click on bar of Oct 20th, the next panel should show me data for past 15 days (6th Oct to 20th Oct).

can someone help me with setting up earliest and latest time through tokens for above scenario?




Labels (2)
Tags (3)
0 Karma

sanjum01
Explorer

so it means if i take the value from time picker as a token I can try  like below?  because number is not always going to be 15 it depends on what user select on time picker.

 

 

 

<eval token="newearly">relative_time($click.value$,"-TokenTimePicker")</eval>

 

 

 
 
0 Karma

sanjum01
Explorer

@ITWhisperer the solution you provided works with fixed number of days in eval. but I need to give the number from time picker..
here is what I have.

<fieldset submitButton="false">
<input type="time" token="field1">
<label></label>
<default>
<earliest>-7d@d</earliest>
<latest>now</latest>
</default>
.
.
.
.
<drilldown target="_blank">
<set token="datatype_value">$click.value$</set>
<set token="time1">$click.value$</set>
<eval token="time2">relative_time($click.value$, "-$field1$")</eval>
<link target="_blank">/app/search/trend_by_source_clone_2?form.Datatype1="Lab"&amp;form.second_dash.earliest=$form.field1.earliest$&amp;form.time1=$time1$&amp;form.time2=$time2$</link>
</drilldown>

any help please??

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

<eval token="newearly">relative_time($click.value$,"-15d")</eval>
0 Karma
Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...