Spread our blog

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')
|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.

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.

You can also know about :  Schedule a Report if data is not coming to the index in the last 7 days

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!!

What’s your Reaction?

Spread our blog


Please enter your comment!
Please enter your name here