Splunk Cloud

Search Reference

Acrobat logo Download manual as PDF

Acrobat logo Download topic as PDF



Calls an external python program that can modify or generate search results. Scripts must be declared in the commands.conf file and be located in the $SPLUNK_HOME/etc/apps/<app_name>/bin/ directory. The script is executed using $SPLUNK_HOME/bin/python.

If you are using Splunk Cloud and want to install a custom script, file a Support ticket. Before being installed, your script is checked to ensure it complies with Splunk requirements for security, data safety, and so on.


script <script-name> [<script-arg>...] [maxinputs=<int>]

Required arguments

Syntax: <string>
Description: The name of the scripted search command to run, as defined in the commands.conf file.

Optional arguments

Syntax: maxinputs=<int>
Description: Specifies how many of the input results are passed to the script.
Default: 100
Syntax: <string> ...
Description: One or more arguments to pass to the script. If you are passing multiple arguments, delimit each argument with a space.


The script command is effectively an alternative way to invoke custom search commands. See <a href="https://dev.splunk.com/enterprise/docs/devtools/customsearchcommands/">Create custom search commands for apps in Splunk Cloud or Splunk Enterprise</a> in the Developer Guide on the Developer Portal.

The following search

| script commandname

is largely synonymous with

| commandname

Note: Some functions of the script command have been removed over time. The explicit choice of Perl or Python as an argument is no longer functional and such an argument is ignored. If you need to write Perl search commands you need to declare them as Perl in the commands.conf file. This is not recommended, as you need to determine a number of underdocumented things about the input and output formats. Additionally, support for explicit filename reference for scripts in the etc/searchscripts directory has been removed. All search commands must now be declared in the commands.conf file.


Example 1:

Run the Python script "myscript" with arguments, myarg1 and myarg2; then, email the results.

... | script myscript myarg1 myarg2 | sendemail to=david@splunk.com

Last modified on 15 September, 2020

This documentation applies to the following versions of Splunk Cloud: 7.0.13, 7.2.9, 7.2.10, 8.0.2006, 8.0.2007, 8.1.2008, 8.1.2009, 8.1.2011, 8.1.2012 (latest FedRAMP release), 8.1.2101, 8.1.2103, 8.2.2104, 8.2.2105

Was this documentation topic helpful?

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

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters