Splunk® Enterprise

Dashboards and Visualizations

Download manual as PDF

Splunk Enterprise version 6.x is no longer supported as of October 23, 2019. See the Splunk Software Support Policy for details. For information about upgrading to a supported version, see How to upgrade Splunk Enterprise.
This documentation does not apply to the most recent version of Splunk. Click here for the latest version.
Download topic as PDF

About editing simple XML

By default, dashboards in Splunk are based on underlying simple XML code. You can use Splunk's interactive editors to create and edit dashboards without having to edit the simple XML. However, some dashboard features (such as maps and forms) are not available from Splunk editors and can only be created and maintained by editing the underlying simple XML code.

This topic describes some of the basics of editing simple XML. The following topics of this chapter provide 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 Splunk Simple XML Reference.

XML editors

You have a couple options for editing simple XML files for dashboard and forms.

  • 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:

  • You must have write access to your Splunk installation so you can access the XML files and supporting CSS and JavaScript files. If you do not have write access, check with your Splunk admin.
  • Check file system permissions of your source files.
    After copying over your files, makes sure that the Splunk instance 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 instance.
    After making changes to a dashboard XML file in the file system, you need to refresh your Splunk instance so it displays in Splunk Web. This step is not necessary if you use Splunk's Source Editor. Use the following URL to refresh your Splunk instance. After refreshing the instance, reload the dashboard you are editing. For example, for the default location on a local version of Splunk Enterprise:
http://localhost:8000/debug/refresh

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:

Character HTML Entitiy
'
&apos;
<
&lt;
>
&gt;
&
&amp;

Source files for dashboards and forms

Source files for Splunk dashboards include simple XML files, JavaScript files, and CSS stylesheets. Source files also include static HTML and image files that you import by reference.

Splunk expects source files in specific places in your Splunk instance, as described below.

Source files for views

The views directory of an app contains the source files for views coded in simple XML or legacy advanced XML. The location depends on permissions for the dashboard: shared in app or private.

Place simple XML and advanced XML source files in the following locations:

Shared permission
$SPLUNK_HOME/etc/apps/<app>/local/data/ui/views/<dashboard_file_name>

Private permission
$SPLUNK_HOME/etc/users/<user>/<app>/local/data/ui/views/<dashboard_file_name>

The html directory of an app contains the source files for views converted to HTML.

Place HTML source files in the following locations:

Shared permission
$SPLUNK_HOME/etc/apps/<app>/local/data/ui/html/<dashboard_file_name>

Private permission
$SPLUNK_HOME/etc/users/<user>/<app>/local/data/ui/html/<dashboard_file_name>

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, Splunk looks first in the local directory for resources. Anything present in local takes precedence over the same resource in the default directory.

However, if you place source files in the default directory you can lose your changes during updates. When you update Splunk, or update an app within a Splunk instance, Splunk overwrites the contents of the default directory, but leaves the local directory untouched. So 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 Splunk Dashboard Editor writes to the local path.

For more information on file precedence in Splunk, see Configuration file precedence.

CSS, JavaScript, and other static files

A dashboard can import CSS and JavaScript files as well as image files and static HTML files. Splunk looks for these files in the following location. The files cannot be in a subdirectory.

$SPLUNK_HOME/etc/apps/<app_name>/appserver/static/

By default, this directory contain the following two files:

  • dashboard.css
  • dashhboard.js

You can edit Splunk's default files at this location or add additional CSS and JavaScript files. You can also add any HTML files that you want to reference from a dashboard.

Import JavaScript and CSS files

Use the script and stylesheet attributes to <dashboard> or <form> to import a JavaScript or CSS file from the default location for an app. You can also reference script and CSS files from other apps.

For example:

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 and forms 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.

Last modified on 28 June, 2016
PREVIOUS
Generate dashboard PDFs
  NEXT
Searches power dashboards and forms

This documentation applies to the following versions of Splunk® Enterprise: 6.0.1, 6.0.2, 6.0.3, 6.0.4, 6.0.5, 6.0.6, 6.0.7, 6.0.8, 6.0.9, 6.0.10, 6.0.11, 6.0.12, 6.0.13, 6.0.14, 6.0.15


Was this documentation topic helpful?

Enter your email address, and someone from the documentation team will respond to you:

Please provide your comments here. Ask a question or make a suggestion.

You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters