About editing simple XML
You can use Splunk platform interactive editors to create and edit dashboards without having to edit the simple XML. However, some advanced dashboard features are not available from interactive editors. You can access these features by editing the underlying simple XML code.
This chapter describes some of the basics of editing simple XML. It contains detailed examples of features available for dashboards and forms with simple XML.
For details on the structure of dashboards and forms, see Anatomy of dashboards and forms.
For details on simple XML syntax, refer to the Simple XML Reference.
You have a couple options for editing simple XML files for dashboard and forms.
- Edit the simple XML using the XML Source Editor
See Create and edit dashboards from Splunk Web for information on using the Splunk XML editor. The section Edit the source XML describes how to access and use the editor.
- Edit the simple XML source files using your favorite third party editor for XML.
See below for Splunk environment information you need to know about when using third party editors.
Third party XML editor
If you use a third party editor for simple XML, keep in mind the following:
- Check file system permissions of your source files.
After copying over your files, makes sure that you can read and write to the files. This is different than setting the access permissions for users of a dashboard from Splunk Web.
- Refresh your Splunk platform instance.
After making changes to a dashboard XML file in the file system, you need to refresh your instance so it displays in Splunk Web. This step is not necessary if you use the Source Editor. Use the following URL to refresh your instance. After refreshing the instance, reload the dashboard you are editing.
Special characters in XML files
Some characters have special meaning in an XML file and cannot be used literally. You can wrap the text within CDATA tags as illustrated below. The XML parser does not process text within CDATA tags.
<![CDATA[ <code>"Text within a CDATA tag"</code> ]]>
Or you can escape these characters using HTML entities:
Source files for dashboards and forms
Source files are in specific places in your Splunk platform instance, as described below.
Source files for views and panels
views directory of an app contains the following source files:
- Views coded in simple XML.
- Views coded in legacy advanced XML.
- Panel files available by reference in a dashboard. See Create and add a panel by reference.
The location of the source files depend on permissions for the dashboard: shared in app or private.
Place simple XML and panel source files in the following locations:
html directory of an app contains the source files for views converted to HTML. The location of the source files depend on permissions for the dashboard: shared in app or private.
Place HTML source files in the following locations:
Default or local
You can place source files in a path that uses either the default or local directory. However, you typically place dashboard source files in a path that includes the local directory.
The local directory takes precedence over the default directory. That is, the Splunk platform looks first in the local directory for resources. Anything present in local takes precedence over the same resource in the default directory.
If you place source files in the default directory you can lose your changes during updates. When you update the Splunk platform, or update an app within a Splunk platform instance, the update overwrites the contents of the default directory, but leaves the local directory untouched. Place your dashboard source simple XML files in the local directory to ensure that they are not lost after an update. The previous examples in Simple XML source files use the local directory.
The Dashboard Editor writes to the
For more information on file precedence, see Configuration file precedence.
Read-only access to Simple XML and HTML source code
Access a read-only version of HTML dashboard source code by using a query string. To view the HTML source code, append
?showsource=html to the dashboard url. Here is an example.
By default, this directory contains the following two files:
Import files from the same app
<dashboard script="myScript.js" stylesheet="myStyles.css"> . . . </dashboard>
Import files from another app, named myApp
<dashboard script="myApp:myScript.js" stylesheet="myApp:myStyles.css"> . . . </dashboard>
Dashboards and forms
Before editing dashboards, forms, and panel files in simple XML source code you should be familiar with the basic layout of dashboards and the XML elements that define them. Refer to Anatomy of dashboards and forms to learn about the basic structure.
The Simple XML Reference and the Chart Configuration Reference provide details on all the simple XML elements and options available for creating dashboards and forms. Refer to these references for coding details.
Generate dashboard PDFs
Searches power dashboards and forms
This documentation applies to the following versions of Splunk® Enterprise: 6.4.0, 6.4.1, 6.4.2, 6.4.3, 6.4.4, 6.4.5, 6.4.6, 6.4.7, 6.4.8, 6.4.9, 6.4.10, 6.4.11