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!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...