Creating dashboards in Splunk - Understanding the XML
As we saw in this post, a dashboard's structure is built from standard XML code with specific sections for each element we are working with.
When we create a dashboard in Splunk, we get a structure similar to the one below:
<dashboard>: Template
<label>: Dashboard title
<row>: defines each row of charts
<panel>: defines each panel
<title>: chart title/subtitle
<chart>: chart type
<search> defines the search
<query>: search </query>
<earliest>timepicker earliest setting</earliest>
<latest>timepicker latest setting</latest>
</search>
<option>: options for the chosen chart type</option>
</chart>
</panel>
</row>
</dashboard> We get to this structure by clicking the "Source" option on the dashboard edit screen.
We can say there are two essential elements in this structure: rows and panels.
A row is a line in the dashboard that can hold one or more visual elements, whether panels or HTML code. Each row can contain one or more visualization elements.
Panels can contain charts/tables, HTML code or both. Each panel also holds the searches used to build its visualizations.
In the example below we have a dashboard with two rows and two panels in each:
<dashboard>
<row>
<panel>
</panel>
<panel>
</panel>
</row>
<row>
<panel>
</panel>
<panel>
</panel>
</row>
</dashboard>Visually, we would get the following result in the dashboard UI:

Note: when you paste the code above, you will see some XML validation error messages. You can ignore them; they only point out that the "panel" tags are empty.
Notice that this dashboard now has four elements, two in each row (look at the boxes that say "No title").
As mentioned earlier, you can also insert HTML code into a dashboard, as in the following example:
<dashboard>
<row>
<panel>
<html>Texto</html>
</panel>
<panel>
</panel>
</row>
<row>
<html>Texto</html>
</row>
</dashboard>The result in the UI would be:

Now we have three boxes, two in the first row and one in the second. In two of them we included HTML text.
HTML code inserted into a dashboard can use the language's usual elements, such as images, videos, formatting and even CSS. We will soon have a new post going deeper into what HTML code can do, along with more formatting tips for a better dashboard.
Questions about the post? Content suggestions? Corrections? Criticism or praise?
Please contact us at wevaluatebr@gmail.com and we will reply as soon as possible.
Want to practice? Try the free We Challenge sample, with Splunk questions and explanations.
To start from scratch, see the Introduction to Splunk course on Udemy (in Portuguese). For your team, see WeValuate's Splunk training.
If you liked it, share this post on your social networks and help us spread the word!

Comments