Dashboards & Visualizations

How to set up a drilldown to pass the selected "pan+zoom" time range as a token to another view?


I am attempting to pass the selected time range of the "pan + zoom" function in simplified XML to another view. meaning that when the timerange picker defaults to 60 minutes, and if a user selects only 15 minutes, then clicks on the chart, the dashboard passes ONLY the selected 15 minutes out of the entire 60 minute selection.

Currently, when I select a time range then click, it takes the entire 60 minute selection,instead of the selected 15 minutes. Contextually, these tokens work fine in the same dashboard, however they don't pass to another view. Does anyone know which tokens I should be using?

Here is my XML:

      <chart id="cpu_detail" depends="$host2$">
        <title>Average CPU % Over Time for $host2$   (click to drilldown)</title>
        <searchString>index=myIndex  host=$host2$ collection=CPU counter="% Processor Time" instance=_Total | timechart avg(Value) by host useother=f</searchString>
        <option name="charting.axisLabelsX.majorLabelStyle.overflowMode">ellipsisNone</option>
        <option name="charting.axisLabelsX.majorLabelStyle.rotation">0</option>
        <option name="charting.axisTitleX.visibility">visible</option>
        <option name="charting.axisTitleY.visibility">visible</option>
        <option name="charting.axisTitleY2.visibility">visible</option>
        <option name="charting.axisX.scale">linear</option>
        <option name="charting.axisY.scale">linear</option>
        <option name="charting.axisY2.enabled">false</option>
        <option name="charting.axisY2.scale">inherit</option>
        <option name="charting.chart">line</option>
        <option name="charting.chart.nullValueMode">zero</option>
        <option name="charting.chart.sliceCollapsingThreshold">0.01</option>
        <option name="charting.chart.stackMode">default</option>
        <option name="charting.chart.style">shiny</option>
        <option name="charting.drilldown">all</option>
        <option name="charting.layout.splitSeries">0</option>
        <option name="charting.legend.labelStyle.overflowMode">ellipsisMiddle</option>
        <option name="charting.legend.placement">right</option>
        <option name="charting.axisTitleY.text">CPU %</option>
          <set token="selection.begin">$start$</set>
          <set token="selection.end">$end$</set>

Splunk Employee
Splunk Employee

Unfortunately the drilldown will only take the click values. To get past this limitation you can add an HTML panel that displays the correct link. For example -

    <label>Pan/Zoom test</label>
                <title>Pan and Zoom (All source types)</title>
                    index=_internal | timechart count by sourcetype
                    <set token="selection_earliest">$start$</set>
                    <set token="selection_latest">$end$</set>
                    <set token="start_splunk_web_access">$start.splunk_web_access$</set>
                    <set token="end_splunk_web_access">$end.splunk_web_access$</set>
                    <set token="url">
  http://localhost:8000/en-US/app/search/search?earliest=$selection_earliest$&latest=$selection_latest... index%3D_internal]]>
            <p> <a href="$url$" target="_blank">Link for pan/zoom - $url$</a> </p>



To return to the previous time range after clicking that link ("Link for pan/zoom"), I have found that I need to click my web browser's Back button twice, because of the way that Splunk Web sets form parameters in the URL query string after loading a dashboard.

When you initially click that link, the browser URL is exactly what $url$ sets it to. But when the dashboard at that URL loads, Splunk Web updates the URL query string ( ?... ) with the dashboard form parameters. This introduces an additional URL to the browser history, hence a second click of the Back button to return to the previous dashboard and its time range.

Or am I missing something?

0 Karma


With apologies if this is stating the bleeding obvious: if, as I do, you want the link to set the time range of the current dashboard (to the marquee-selected time range in the chart), then your URL can consist of just the query string:

<set token="url">

Related note: dashboards that I design these days typically contain a "master" timechart at the top, just under the form UI controls. Only the search for that master timechart and form UI controls refer to the values of the global time picker in the form UI controls:


All other searches in the dashboard—all visualizations under that master timechart—refer to the time range selected by that master timechart:


The HTML visualization containing the link appears directly under the master timechart.

Having that master timechart at the top offers an easy way to zoom and pan around within the time range set by the time picker.

0 Karma


Please see this image. This chart is connected to the time-range picker, so $earliest$ and $latest$ will always remain the same, however I want to pass just the time range circled in red, to the next view. Which tokens would I use?

alt text

0 Karma
Get Updates on the Splunk Community!

Registration for Splunk University is Now Open!

Are you ready for an adventure in learning?   Brace yourselves because Splunk University is back, and it's ...

Splunkbase | Splunk Dashboard Examples App for SimpleXML End of Life

The Splunk Dashboard Examples App for SimpleXML will reach end of support on Dec 19, 2024, after which no new ...

Understanding Generative AI Techniques and Their Application in Cybersecurity

Watch On-Demand Artificial intelligence is the talk of the town nowadays, with industries of all kinds ...