Example: Basic dashboard using a Simple XML extension
Was this page helpful?
Was this page helpful?
On this page
This example shows how to use a Simple XML extension to create a basic template with a chart and an events viewer that displays results from a search.
To use this code:
- Save the XML file under an existing app in $SPLUNK_HOME/etc/apps/<app_name>/local/data/ui/views/.
- Save the JS file under $SPLUNK_HOME/etc/apps/<app_name>/appserver/static/.
- Restart Splunk.
- Open Splunk Web and view the dashboard in your app. For example, to view examplename in mysplunkapp, go to
http://<localhost:port>/app/mysplunkapp/examplename
.
example_basicpage.xml
<dashboard script="example_basicpage.js"> <label>Basic example</label> <row> <panel> <html> <h3>A chart and an events viewer displaying results of a search</h3> <div id="mychart"></div> <div id="myeventsviewer"></div>
...
example_basicpage.js
require([ "splunkjs/mvc/searchmanager", "splunkjs/mvc/chartview", "splunkjs/mvc/eventsviewerview", "splunkjs/mvc/simplexml/ready!" ], function( SearchManager, ChartView,
...