1. Create an app for the tutorial with a Simple XML dashboard and extension

This first step covers the preliminary app setup by creating an app for the tutorial, a dashboard to display the custom view, and a placeholder Simple XML extension that we'll modify later.

Note  You need access to source files on your Splunk Enterprise instance, so you might need to contact your Splunk administrator for permission and access.

  1. On the Splunk Web home page, click the Gears icon next to Apps.
  2. Click Create app.
  3. On the Add new page, fill out the properties of the new app:
    • For Name, enter "Custom View Tutorial".
    • For Folder name, enter "customviewtutorial".
    • Under Template, select "barebones".
  4. Click Save.

Next, add a Simple XML dashboard to the app:

  1. On the Apps page, find the Custom View Tutorial app in the list and click Launch app. (You can also open the app from the Splunk Web home page.)
  2. On the navigation bar at the top of the page, click Dashboards.
  3. Click Create New Dashboard, then fill out the dashboard properties:
    • For Title, enter "Custom View".
    • For Permissions, click Shared in App (this keeps the XML file in the app's folder, $SPLUNK_HOME/etc/apps/customviewtutorial).
  4. Click Create Dashboard.
  5. The new Simple XML dashboard is displayed in edit mode.

  6. Click Edit Source.
  7. In the View box, replace the code with the following:
  8. <dashboard script="customview.js">
    
      <label>Custom View</label>
    
      <row>
        <html>
          <div id="mycustomview"></div>
        </html>
      </row>
    
    </dashboard>
    

    This dashboard has a simple HTML panel where we will display the custom view. The script attribute in the dashboard tag refers to the customview.js extension file that we'll create below.

  9. Click Save, then click Done.

Finally, let's set up the app to use Simple XML extensions. We'll need to create a subfolder in the app for static asset files and add a few JavaScript files.

  1. Create an /appserver/static directory in your app under $SPLUNK_HOME/etc/apps/customviewtutorial. You'll put all of your static assets in this folder.
  2. Create a placeholder for the Simple XML extension we'll use later.
  3. In a text editor, paste the following code into a new file, then save it as customview.js under $SPLUNK_HOME/etc/apps/customviewtutorial/appserver/static:

    /* customview.js */
  4. Create a placeholder for the custom JavaScript class we'll use later.
  5. In a text editor, paste the following code into a new file, then save it as demoview.js under $SPLUNK_HOME/etc/apps/customviewtutorial/appserver/static:

    /* demoview.js */
  6. Now that most of the required files and directory structure are in place, restart Splunk Enterprise.

Continue to 2. Create a "hello, world!" view.