Dashboards & Visualizations

Subtract time from time picker token response

jeffreyleavy
New Member

So I have a "complex search" on a dashboard with a search and a subsearch. I currently have two time pickers on said dashboard, but would like only one. The main search is looking at timepicker1 via token1, and the subsearch is looking at timepicker2 via token2. What I want to do is have the subsearch look at token1 and take 7 days off, so I can do a comparison. so "selectedtime-7d". Is something like this possible. I have done quite a bit of tinkering with no success.

EX: index=logs appname=web earliest=$token1.earliest$ latest=$token1.latest$ | appendcols [search index=logs appname=web earliest=$token2.earliest$ latest=$token2.latest$]

In theory for the subsearch I would like it to be something like [search index=logs appname=web earliest=($token1.earliest$-7d) latest=($token1.latest$-7d) ]

Any way to make this happen?

0 Karma

martin_mueller
SplunkTrust
SplunkTrust
0 Karma

paulbannister
Communicator

HI There

One thing you could try is adding a base search to the dashboard who's sole purpose is to generate these secondary time tokens for you using makeresults, then pull the tokens from this to use in the other search

|makeresults
|eval new_earliest=$token1.earliest$-604800, new_latest=$token1.latest$-604800

A little crude but should do the job

0 Karma

jeffreyleavy
New Member

How would I go about doing that? I have never used makeresults before, and this is my first time with tokens as well.

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...