Enable first-run configuration with setup pages in Splunk Cloud Platform or Splunk Enterprise
A setup page is a page in your app that displays the first time your users launch the app. The setup page provides an interface in Splunk Web that allows your users to configure app settings. Create a setup page to provide your app's users with a workflow for configuring your app in Splunk Web.
In Splunk Cloud Platform, you must provide a setup page for app configuration. In Splunk Enterprise, you can provide a setup page as a best practice for app configuration.
Use cases for setup pages
The following use cases exist for creating a setup page:
- You want to save user-provided configurations in your app. For example, you want to save user input in a custom configuration (.conf) file. You can create a setup page to capture this information and store it in your app's local directory, along with any other modified .conf files.
- You want to integrate your app with an external service. For example, you want to load information into your app from an API hosted outside of the user's Splunk software deployment. You can create a setup page that calls a custom REST endpoint to handle this interaction.
- You want to check whether your app's dependencies are installed. For example, your app requires your users to install a second app to run. You can create a setup page that calls a Splunk REST API endpoint to check whether the secondary app is installed before completing the setup process.
How setup pages work
A setup page is a Simple XML view that uses a Simple XML extension to configure an app. Simple XML extensions are custom-built JavaScript files that add functionality to views in Splunk Web.
The following diagram shows how a user interacts with a setup page to configure a Splunk app:
When a user launches an app in Splunk Web, Splunk software checks whether the app is configured in the app's app.conf file. If the app is not configured, the user is directed to the Simple XML view specified in the app.conf file. If the app is configured, the user is directed to the app's home page.
The Simple XML view uses a Simple XML extension that contains the JavaScript logic that you write to configure the app. You can write this JavaScript code to call Splunk REST API endpoints and to write to your app's .conf files.
After a user completes the setup process, the setup page updates the app's app.conf file to mark the configuration as complete and redirects the user to the app's home page.
Workflow for creating a setup page
The following workflow describes how to create a setup page:
-
Plan your app's setup.
Determine whether your app's setup requires standard .conf file settings, custom .conf file settings, and custom REST API calls. The resources that you need to use in your setup process depend on the type of configurations you want to perform. You also need to determine whether your app requires reconfiguration following app updates. See Plan your setup.
-
Code the setup process for your app configuration.
Write the JavaScript code to configure your app and then mark the setup as complete. See Code the setup process for your app configuration.
-
Create the Simple XML view.
Create the Simple XML view to expose your JavaScript code in your setup page. See Create the Simple XML view.
-
Configure the app.conf file.
Map the Simple XML view to your app configuration and direct your users to this page the first time they launch your app. See Configure the app.conf file.
Deployment considerations for setup pages
In a distributed deployment, setup page components run in the search tier. For more information about where to deploy an app's files and knowledge objects, see How deployment architecture affects a Splunk app in Splunk Cloud Platform or Splunk Enterprise.