I Just Discovered Simple XML Dashboard Extensions!

Categories:

I just discovered that Simple XML dashboards in Splunk can be customized with JavaScript! That's right, the point and click dashboards can be customized in a very powerful way. Here's the official docs, and an official example. Now it's time to show you what I did for my customization.

You can see here that I have a plain old pie chart -- except that the title includes the total event count. Want to put this on your own charts? Keep reading!

First, we'll modify the XML to point to a JavaScript file, and assign an HTML id to the chart.

I will attach my script that you can use or modify, and you can also refer to the official documentation I linked above for more examples.

As you make changes to the JavaScript file, you need to refresh the data/ui/views entity. Just navigate to: https://YOUR_SPLUNK_SERVER/en-US/debug/refresh?entity=data/ui/views and hit the refresh button.

And then, restart Splunk.

Finally, if you're copying my example verbatim, add a number to the chart title. This number is a placeholder that will be replaced when the search for the pie chart completes.

That's all for today. If you have any feedback, please get in touch!

Update: How to add a line break to text in the dashboard:

Have you ever wanted your dashboard description to span multiple lines, or perhaps a multi-line input label? Now that you know how to add JavaScript extensions, this is trivial. Just add the following lines of jQuery to the JavaScript example code attached to this post. This line of code should appear inside of the require function.