splunkdev-cli v0.1.9
The Splunk Dev Command Line Interface (CLI)
When developing Splunk apps, you can use the Splunk Dev command-line interface (CLI) to make it easier to create and manage apps. The Splunk Dev CLI uses Yeoman for templates and Grunt for watch tasks.
Prerequisites
The Node Package Manager (NPM) is used to configure and set up the Splunk Dev CLI, so Node.js must be installed first. To download the latest version of Node.js (we recommend version 0.10.x or later), go to the Node.js website.
Install the Splunk Dev CLI
To install the Splunk Dev CLI (along with dependencies such as Yeoman), open a command prompt and enter the following command:
npm install -g splunkdev-cliNow you'll have access to the Splunk Dev CLI globally, from anywhere on your system.
Using the Splunk Dev CLI
Use the splunkdev command to access the Splunk Dev CLI.
Usage
To use the Splunk Dev CLI, open a command prompt and use the splunkdev command as follows, where optional items are in square brackets:
splunkdev options
splunkdev command [command options] [options]Options
The following table lists the possible command-line options.
Commands
The following table lists the splunkdev commands.
Examples
To get help for the splunkdev command:
splunkdev –h
splunkdev –-helpTo get help for the splunkdev commands apps and watch:
splunkdev apps –h
splunkdev watch –-helpsplunkdev apps
Use the splunkdev apps command to list and manage your Splunk apps. If you don't specify any options, all non-system, enabled apps are listed.
Usage
splunkdev apps [appname] [options]Options
The following table lists the possible command-line options.
Examples
List installed apps:
splunkdev appsList all apps, including disabled and system apps:
splunkdev apps --disabled –-systemList all the apps that start with "test":
splunkdev apps test*Remove the app called "my_app":
splunkdev apps my_app –-removeRemove all apps with names that start with "test":
splunkdev apps "test*" –-removeChange the state of the "my_app" app to disabled:
splunkdev apps my_app --state disabledChange the state of the "my_app" app to enabled:
splunkdev apps my_app --state enabledsplunkdev config
Use the splunkdev config command to configure the CLI login credentials for the current Splunk instance. These credentials are used by splunkdev commands that communicate with splunkd, such as watch, reload, and settings.
Usage
splunkdev config [options]Options
The following table lists the possible command-line options.
Examples
Set the CLI login credentials:
splunkdev configsplunkdev create
Use the splunkdev create command to create a Splunk app. You'll be asked whether to restart Splunk afterwards.
Usage
splunkdev create appname
splunkdev create [options]Options
The following table lists the possible command-line options.
Examples
Create an app called "my_app" without installing node dependencies locally:
splunkdev create my_appCreate an app called "my_app2" and install local node-based tools:
splunkdev create my_app2 -dsplunkdev reload
Use the splunkdev reload command to reload resources and configurations for all apps, without restarting Splunk.
Usage
splunkdev reload [options]Options
The following table lists the possible command-line options.
splunkdev settings
Use the splunkdev settings command to specify whether to use minified files in Splunk.
Usage
splunkdev settings [options]Options
The following table lists the possible command-line options.
Examples
Use unminified CSS and JS files in the web environment:
splunkdev settings -m falsesplunkdev service
Use the splunkdev service command to start, stop, and restart Splunk services. If a particular service is not specified, the action is performed on all services.
Usage
splunkdev service {start | stop | restart} [options]Options
The following table lists the possible command-line options.
Examples
Start all Splunk services:
splunkdev service startRestart all Splunk services:
splunkdev service restartStop all Splunk services:
splunkdev service stopStart the splunkd service:
splunkdev service stop -s splunkdRestart the splunkweb service:
splunkdev service restart --service splunkwebsplunkdev watch
Use the splunkdev watch command to watch for changes to a specific app or to Splunk. When a change occurs that requires restarting a Splunk service or reloading a configuration file, that action is performed automatically. For example, changes to app configuration or Python files require the app resources to be reloaded, and changes to the app's navigation file require splunkweb to be restarted.
To stop the current watch task, press Ctrl+C.
Usage
splunkdev watch [options]Options
The following table lists the possible command-line options.
Examples
Watch for changes to the "my_app" app:
splunkdev watch --app my_app