After you've created an app, you'll want to test and run it.
Typically, you would download an app from SplunkBase using the Manage apps option of the App menu or create a local .spl file, where the app would be installed in the $SPLUNKBASE/etc/apps directory. For demonstration purposes and initial debugging before your app is available on SplunkBase, it is easier to manually install the app, which is what this section describes.
The example dev_tutorial app has the following directory structure, in the $SPLUNK_HOME/etc/apps directory:
Your app is now available to run.
Note: You can also compress your app in a tarball file with a .spl extension and use the App Manager to install your app.
Run the dev_tutorial app the same way you would run any other Splunk app:
Note: Make sure your app status is enabled .
Debugging on your local machine, you can conveniently change your app code, in $SPLUNK_HOME/etc/apps/dev_tutorial, and rerun your app.
The way you restart your app depends on what code you changed. If you changed only client-side code, it is sufficient to upgrade the version number, using _bump, and re-run your app:
Note: Make sure you clear the browser cache before re-running your app.
If you made changes to your XML files and need to reload configuration data, use debug/refresh in addition to _bump to refresh all EAI handlers that support reload:
If you changed server-side code, you need to restart Splunk and SplunkWeb:
Note: Use console.debug("Your debug message"); to log messages to your debugger console.
On the server, you can use the built-in Python logging facilities for debugging.
import logging logger = logging.getLogger('splunk.module.CustomResultsTable')
You can enable debug logging, as described in Enable debug logging, and use the debug logging level:
logger.debug('your debug message')
For simple printf-style debugging, you'll find it easier to use the info logging level:
logger.info('your informative message')
Informative messages are logged in the $SPLUNK_HOME/var/log/splunk/web_service.log file.
You'll find most error messages, including Python execution errors, in the log file: