Admin Manual

 


Use Splunk's command line interface (CLI)

Access and use the CLI on a remote server

This documentation does not apply to the most recent version of Splunk. Click here for the latest version.

Access and use the CLI on a remote server

You can use the uri parameter with any CLI command to send that command to another Splunk server and view the results on your local server. This topic discusses:

For more information, see "About the CLI" and "Get help with the CLI" in this manual.

Send CLI commands to a remote server

The general syntax for using the uri parameter with any CLI command is:

./splunk command object [-parameter <value>]... -uri <specified-server>

The uri value, specified-server is formatted as:

[http|https]://name_of_server:management_port

Also, the name_of_server can be the fully-resolved domain name or the IP address of the remote Splunk server.

Important: This uri value is the mgmtHostPort value that you defined in the remote Splunk server's web.conf. For more information, see the web.conf reference in this manual.

Search a remote server

The following example returns search results from the remote "splunkserver".

./splunk search "host=fflanda error 404 *.gif" -uri https://splunkserver:8089

View apps installed on a remote server

The following example returns the list of apps that are installed on the remote "splunkserver".

./splunk display app -uri https://splunkserver.8089

Change your default URI value

You can set a default URI value using the SPLUNK_URI environment variable. If you change this value to be the URI of the remote server, you do not need to include the uri parameter each time you want to access that remote server.

To change the value of SPLUNK_URI, type either:

$ export SPLUNK_URI=[http|https]://name_of_server:management_port     # For Unix shells
C:\> set SPLUNK_URI=[http|https]://name_of_server:management_port     # For Windows shell

For the examples above, you can change your SPLUNK_URI value by typing:

$ export SPLUNK_URI=https://splunkserver:8089

CLI commands you cannot run remotely

You can run all CLI commands remotely except for commands that control the remote server, such as:

You can view all CLI commands by accessing the CLI help reference. For more information, see "Get help with the CLI" in this manual.

This documentation applies to the following versions of Splunk: 4.0 , 4.0.1 , 4.0.2 , 4.0.3 , 4.0.4 , 4.0.5 , 4.0.6 , 4.0.7 , 4.0.8 , 4.0.9 , 4.0.10 , 4.0.11 View the Article History for its revisions.


You must be logged into splunk.com in order to post comments. Log in now.

Was this documentation topic helpful?

If you'd like to hear back from us, please provide your email address:

We'd love to hear what you think about this topic or the documentation as a whole. Feedback you enter here will be delivered to the documentation team.

Feedback submitted, thanks!