Dashboards & Visualizations

How to have a panel use an offset from a time picker

FeatureCreeep
Path Finder

I would like let a user use a timepicker to look at a problem period in a timechart and then I'd like to display another timechart below it with the same data but a week earlier for comparison. I can't put the data in the same timechart because there are too many metrics to display.

How can I make the bottom panel use an offset from the timepicker? I've tried to modify the XML like this:

<earliest>$tokenTIme.earliest$-7d</earliest>
<latest>$tokenTIme.latest$-7d</latest>

I've also tried to modify the search by doing something like this:

index=a source=b earliest=$tokenTIme.earliest$-7d latest=$tokenTIme.latest$-7d

Any ideas?

0 Karma
1 Solution

somesoni2
Revered Legend

In the second panel, use the current timerange picker as earliest and latest, so that both panels are using same time range.

<earliest>$tokenTIme.earliest$</earliest>
 <latest>$tokenTIme.latest$</latest>

Now, in the search of panel 2, we'll override the timerange from timerange picker values using a subsearch

 index=a source=b [| gentimes start=-1 | addinfo | eval earliest=relative_time(info_min_time,"-7d") | eval latest=relative_time( info_max_time, "-7d") | table earliest latest | format "" "" "" "" "" "" ] |...rest of the search

The addinfo command in the subsearch will give value of current earliest and latest (from time range picker) as info_min_time and info_max_time respectively.

View solution in original post

somesoni2
Revered Legend

In the second panel, use the current timerange picker as earliest and latest, so that both panels are using same time range.

<earliest>$tokenTIme.earliest$</earliest>
 <latest>$tokenTIme.latest$</latest>

Now, in the search of panel 2, we'll override the timerange from timerange picker values using a subsearch

 index=a source=b [| gentimes start=-1 | addinfo | eval earliest=relative_time(info_min_time,"-7d") | eval latest=relative_time( info_max_time, "-7d") | table earliest latest | format "" "" "" "" "" "" ] |...rest of the search

The addinfo command in the subsearch will give value of current earliest and latest (from time range picker) as info_min_time and info_max_time respectively.

FeatureCreeep
Path Finder

Wow, that's clever and worked perfectly! I've learned 2 new commands and an awesome technique. Thanks!

0 Karma
Get Updates on the Splunk Community!

Splunk Answers Content Calendar, July Edition I

Hello Community! Welcome to another month of Community Content Calendar series! For the month of July, we will ...

Secure Your Future: Mastering Upgrade Readiness for Splunk 10

Spotlight: The Splunk Health Assistant Add-On  The Splunk Health Assistant Add-On is your ultimate companion ...

Observability Unlocked: Kubernetes & Cloud Monitoring with Splunk IM

Ready to master Kubernetes and cloud monitoring like the pros? Join Splunk’s Growth Engineering team on ...