So you want to build a better dashboard, do you? Well good, you’ve come to the right place!
Splunk dashboards are amazing. They are incredibly versatile and customizable. The creation of a dashboard is incredibly simple and can be done all through the UI. If more in-depth customization is required, that can be done through the SimpleXML using HTML panels, in-line CSS, or by uploading a new app from Splunkbase or custom JS/CSS. If running Splunk Enterprise version 8.x and above, there’s even a cool Splunk Dashboards app to check out that allows for even more features and utilizes JSON over SimpleXML.
We’re going to dive into some important topics regarding the best practices when creating and maintaining a dashboard. Let’s hop to it!
Dashboards have both names and ids, it is best to have a naming convention for the id, and if possible, the name.
One naming standard could be to begin the id and name with a unique identifier, such as the team, customer, or tool the dashboard is for. Implementing a naming convention can make it much easier to find dashboards, and to add dashboards to the navigation app bar.
Another thing to keep in mind is when cloning a dashboard, remember to keep the id unique. Either keep _clone at the end of the id or replace it with _v2, your username, or something similar. If multiple dashboards exist in the same app space with the same id, even when the app title differs, an issue arises where changes made in either dashboard are saved in both dashboards. This is most definitely not a best practice! Make sure you keep your ids unique!
When using REST API to query dashboard configurations, it will use the id, not the dashboard title, so keep that in mind when naming, as well.
It would be amazing to have a standard dashboard template for various teams or various use cases, however, no two use cases are ever really the same. Just follow these layout and design guidelines and everyone should get along just fine.
The dashboard should be built for the use case, and nothing more. Dashboards only need to display necessary information to the use case. Keep the most important information at the top and related information together.
If there are any custom visualizations being used, it’s a good idea to open the dashboard on various browsers and change the screen size to ensure that the layout doesn’t change. If the visualization seems buggy, it’s good to either fix the issues or make it known that it might not render properly on certain browsers.
Titles, descriptions, labels, etc. are all a user’s best friend when trying to understand a dashboard. Providing additional documentation with references, such as contacts and field definitions, can be extremely helpful; these can be added in an HTML panel within the SimpleXML dashboard. My personal preference is to create the necessary documentation at an external location and add the link to the dashboard.
On the topic of adding titles, it is recommended to use title case for dashboard, panel, or element titles (ie: Capitalize the Important Words). Titles should also be short and to the point.
It is recommended to use sentence case for descriptions and labels (ie: These are some good looking dashboards!).
Don’t:
Do:
When choosing a visualization for a panel, pick the one that best displays the data. For example, if the data is trending over time, line charts or columns charts work well. Use a pie chart if displaying the entire composition for a defined field. There are many types of visualizations available out of the box with Splunk, and even more that can be installed via Splunkbase, so think about how best to display the data and find the right visualization for it.
Key takeaways from this old fake-beard:
index=_audit host=<host> action=search info=completed provenance=*Dashboard* |rex field=_raw ", search=\'(?<thesearch>.*)" |stats dc(search_id) as search_count sum(total_run_time) as total_run_time earliest(thesearch) as search by app provenance savedsearch_name |eval _raw=provenance.app.search |cluster showcount=true t=.7 labelonly=true |fields - _raw |sort - cluster_count cluster_label |eventstats sum(total_run_time) as cluster_run_time by cluster_label |eventstats sum(total_run_time) as stack_total_run_time |eval cluster_pct=cluster_run_time*100/stack_total_run_time
<refresh>300s</refresh> <refreshType>delay</refreshType> </search>
Instead of
<form refresh=”300”>
or
<dashboard refresh=”300”>
!--This is an example comment that would explain what my below panel and search might be doing --> <panel> <title>Panel 1</title> <chart> <search> <query>.....</query>.....
<search ref=”savedsearch_name”> ... <search> <query>|loadjob savedsearch=”owner:app:savedsearch_name”</query> ... <search> <query>|loadjob savedsearch=”owner:app:savedsearch_name” ignore_running=false</query> ... <search> <query>|savedsearch savedsearch_name </query> ...
Example: If you have an input of employee names, perhaps first create an input of employee last initial, to filter the employee names. Excuse the random run-anywhere code.
<search id="name_base"> <query>|makeresults|eval alphabet="A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"|makemv alphabet|mvexpand alphabet</query> </search> ... <input type="dropdown" token="eli"> <label>Employee Last Initial</label> <fieldForLabel>alphabet</fieldForLabel> <fieldForValue>alphabet</fieldForValue> <search base="name_base"></search> </input> <input type="dropdown" token="en"> <label>Employee Name</label> <fieldForLabel>name</fieldForLabel> <fieldForValue>last_name</fieldForValue> <search base="name_base"> <query>|eval name="test ".alphabet."foo"|table name|eval last_name=mvindex(split(name," "),1)|search last_name=$eli$*</query> </search> </input>
<dashboard theme="dark"> <label>search_depends</label> <description>test</description> <init> <unset token="dont_run"></unset> <set token="run"></set> </init> <row> <panel> <single> <title>Unset Token</title> <search depends="$dont_run$" id=”dont_run”> <query>|makeresults|eval data="Can you see me?!"</query> <earliest>-24h@h</earliest> <latest>now</latest> </search> <option name="drilldown">none</option> <option name="rangeColors">["0x53a051","0x0877a6","0xf8be34","0xf1813f","0xdc4e41"]</option> <option name="refresh.display">progressbar</option> <option name="underLabel"># tickets closed last month</option> </single> </panel> </row> <row> <panel> <single> <title>Set Token</title> <search depends="$run$" id=”run”> <query>|makeresults|eval data="Can you see me?!"</query> <earliest>-24h@h</earliest> <latest>now</latest> </search> <option name="drilldown">none</option> <option name="rangeColors">["0x53a051","0x0877a6","0xf8be34","0xf1813f","0xdc4e41"]</option> <option name="refresh.display">progressbar</option> <option name="underLabel"># tickets closed last month</option> </single> </panel> </row> </dashboard>
<search id=”base_search1_dashboard1”>
Will show up in the audit logs with savedsearch_name=base_search1_dashboard1.
This post did not go into many details, because every environment is different, and everyone should create their own best practices. This is meant to be used as a starting point of things to think about when creating dashboards. Most points highlighted here can also be applied to the Splunk Dashboards App, even though my examples were focused around SimpleXML.
March 2021, Splunk Enterprise v8.1.3
The Splunk platform removes the barriers between data and action, empowering observability, IT and security teams to ensure their organizations are secure, resilient and innovative.
Founded in 2003, Splunk is a global company — with over 7,500 employees, Splunkers have received over 1,020 patents to date and availability in 21 regions around the world — and offers an open, extensible data platform that supports shared data across any environment so that all teams in an organization can get end-to-end visibility, with context, for every interaction and business process. Build a strong data foundation with Splunk.