Donut Custom Visualization – Drilldown

Donut Custom Visualization – Drilldown

Hi all,
Today we have come with a new and very important trick of Splunk. You might have read our previous blog on Donut-Custom Visualization. But the problem is normal drill down will not work with this visualization. What is the solution then? Don’t worry, that’s why we are here today.

Query of Donut panel

index="_internal" sourcetype=splunkd_ui_access
|stats count by method
|eventstats max(count) as max
|addcoltotals labelfield=method count
|filldown max
|eval aa=round((max/count)*100)
|eval aa = if(method="Total",aa,'NULL')
|reverse
|filldown
|fields - max
|search NOT method=Total
|eval aa=aa."%"
|eval {aa}=count
|fields - count aa

This is our Donut, now follow the below steps.

Step 1:
Now create your drill down panel first, in our case it like this


Click on the Save as and select Dashboard panel and select same dashboard.
NOTE: In our case we have used the same query for drill down panel.


It will look like this.

Step 2:
Now below I am attaching the Java Script, put it in the following path $SPLUNK_HOME/etc/apps/<app name>/appserver/static
And restart your Splunk server.
To download he js file click here . We have uploaded as docx file but while saving try to create in “.js” format.
Before putting this make the following changes in the JS as shown in below figure.

You can also know about :  How to Find the Difference between Opened Date of Tickets and Closed Date of Tickets of any Incident Using SPLUNK


Just replace the field values with yours and the rest will be the same.

Step 3:
After that come back to the dashboard click on Edit and go to source code.
Make the following changes as shown in below in the source code.


1. Within the dashboard tag add script=”<name of the JS file>”
2. In the Donut panel mention the ID that already assigned in JS
3. To hide the drill down panel add depends=”$tokLabel$”
4. In the drilldown panel  query add |search <field name>=”$tokLabel$”
Save it and reload the page once. Click on any of the slices of Donut and you can see the respective data in drill down panel.


If you want to download the source code of this dashboard click here.
Hope you understood this topic on “Donut Custom Visualization – Drilldown”

Happy Splunking!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.