Your First AppInspect

The app we have created for this tutorial doesn't meet Splunk's recommended app criteria. To find the issues we'll use Splunk AppInspect, which is a tool that checks your app to ensure it complies with certain best practices. You can run AppInspect locally on your computer or through a web service. For details, see the Splunk AppInspect documentation.

Let's walk through how to use AppInspect to find errors in your app.

  1. Install AppInspect. For details, see Install Splunk AppInspect.
  2. This tutorial uses version If you aren't sure which version of AppInspect you installed, open a command prompt and run the following command:

    splunk-appinspect list version
  3. At a command prompt, run AppInspect on your app. You'll need to specify the app's folder or the package file (.tar.gz). When you run AppInspect on the app's folder, as we'll do in this example, you might see errors related to files that you should remove during packaging, such as .DS_Store or .gitignore files. Remove these files before you submit your app to Splunkbase for publishing.
  4. Enter the following command, replacing the path to your app:

    splunk-appinspect inspect path_to_your_splunk_app --included-tags splunk_appinspect

    This command runs a set of basic AppInspect checks. For a full list of AppInspect commands, see Use the AppInspect CLI tool.

    AppInspect reports several issues for your app as shown below:

    Let's walk through how you can fix the issues AppInspect is reporting as failures.

    • The app is missing a README file in its base directory. AppInspect asks you to include information about support, system requirements, installation, configuration, troubleshooting, and using the app. Or, include a link to online documentation.
    • To fix this issue, add a README file to your app.

    • Because we're running AppInspect on an app's directory rather than a packaged file, AppInspect expects a [package] stanza in the app configuration file in /default/app.conf. The [package] stanza is required for the Splunk Packaging Toolkit to recognize your app. For details, see the Splunk Packaging Toolkit documentation.
    • To fix this issue, add the following stanza to that file:

    • The app has meta settings in the /metadata/local.meta file.
    • To fix this issue, copy these settings to /metadata/default.meta, then delete /metadata/local.meta.

      Note  If you already followed the steps in Use macros to avoid index dependency, migrate the [macros/default_index] stanza from the local.meta file to the default.meta file before you delete local.meta.

    • AppInspect requires the /local folder to be deleted.
    • To fix this issue, migrate any settings you want to preserve from /local to /default, then delete the /local folder.

      For example, copy the modified app version number from your /local/app.conf to /default/app.conf, which should look like this now:

    • The remaining issues are related to the requirement for apps to have icon files in the app's /static folder (a 36x36 pixel file named appIcon.png, and a 72x72 pixel file named appIcon_2x.png).
    • To fix this issue, add these icon files to your app's /static folder. For details and for example images, see Add icons to your app.

  5. Run AppInspect again to verify that these issues have been resolved.