Take a moment to complete our quick CSAT survey.Fill the survey

 Package your SPL2-based application

Before packaging an SPL2-based application, you must first download your modules into the /apps/<app_name> folder, cleanup the files in the /apps/<app_name> folder, and add your README file. You can then package the application.

 Download the app modules

You must download the app modules from the data orchestrator to your /apps/<app_name> folder.

  1. In the Splunk CLI, navigate to the $SPLUNK_HOME folder.

  2. Use the download-spl2-modules command to download the modules. The following example shows the command to specify:

    ./bin/splunk download-spl2-modules app <app-name> -dest default
    
  3. You are prompted to confirm that the action will overwrite the any files in the destination folder and that the action can't be undone. Type y to confirm the download.

    Info Circle

    If you receive an error like An authentication error occurred: Client is not authenticated, add the authentication to the download-spl2-modules command. For example:

    Info Circle

    ./bin/splunk download-spl2-modules app <app-name> -dest default -auth <userid>:<password>

Under the /default/data/ folder, a new folder called spl2, is created. The modules are added to that folder.

The following image shows the folder structure for an app that consists of 3 modules: setup, _default, and functions.

A tree structure that shows where the application modules are installed. In this example, under the spl2 directory there are 3 modules as described before the image.

 Confirm the module dowload

You can confirm that the modules were downloaded by navigating to the $SPLUNK_HOME/etc/apps/<appname>/default/data/spl2/ folder. Use a text editor to open the module files and confirm their contents.

 Remove unnecessary folders or files

Before you proceed with packaging your app, you can remove any unnecessary folders or files from the app. For example:

  • If your app doesn't contain any scripts, you can remove the bin folder from the app.
  • Under /default/data/ui/views a blank README file is added by default when you create a blank app. This is the folder where dashboard information is stored. If you don't need that README file, you can remove it.

 Move the local folder contents to the default folder

As part of creating your SPL2-based app, some items might have been created in the apps/<app_name>/local folder. Except for the app.conf file, these items must be moved to the apps/<app_name>/default folder before you package the app.

After the app is installed, Splunk Admins can create a local folder if they decide to customize your app.

Before you package the app, you must:

  1. If necessary, manually move the contents from the local folder to the default folder. Do not move the app.conf file.
  2. Delete the local folder in your app.

 Add your app-level README to the app

In the root folder of your app, place the README file for that app.

For more information about the instructions and guidance you should include in the app-level README file, see Prepare SPL2-based apps for packaging.

 Package your app

Packaging the app enables you to deploy your Splunk app to other Splunk deployments or to Splunkbase.

Info Circle

As part of packaging the app, you must merge the local.meta file contents into the default.meta file.

The CLI command to package an app and merge the local.meta file contents is:

./bin/splunk package app <app_name> -merge-local-meta t

 Where the package is stored

This command creates a tar archive of the /app folder and saves the package with the .spl file extension to the $SPLUNK_HOME/share/splunk/app_packages folder.

  • Dashoard information is stored in an XML file located in the /default/data/ui/views folder.
  • Information about saved searches, or reports, are stored in the savedsearches.conf file located in the /data folder.
  • Information about lookups is stored in the transforms.conf file located in the /data folder.

 More information about packaging apps

 Next step

After you package your app, you should test that the installation of your app occurs without errors. See Test the installation of your SPL2-based application.