Control access to the custom command and script

After you write the script and add it to commands.conf, you are good to go.

By default, all roles have read access to commands.conf, but only admins have write access. This means that all roles can run the commands listed in commands.conf, unless the access controls are explicitly changed for an individual command. If you want to restrict the usage of the command to certain roles or users, you must modify the access controls for the command.

Change custom command permissions

You can modify the access controls through the Settings menu, or by editing the default.meta file.

Change permissions in Splunk Web

You can use the Settings menu to change the access controls for a command, by user role.

1. In Splunk Web, select Settings, Advanced search.

2. Click Search commands.

3. Under the Sharing column for the search command, click Permissions.
This opens the Permissions view for the selected search command. Use this page to specify:

If the command should appear in the current app or all apps.

Which roles are have read and write access to the command.

4. Don't forget to save your changes!

Change permissions in the default.meta file

You can change the access controls for a command using the default.meta file, which is located in the $SPLUNK_HOME/etc/apps/<app_name>/metadata/ directory.

The following example shows the default access for the commands.conf and the access permissions for the input command, which you cannot run unless you are an admin.

Change access control to the command script files

You can change the access control restrictions on the command script files. These controls are defined in the [searchscripts] stanza in the $SPLUNK_HOME/etc/apps/<app_name>/metadata/default.meta file. By default, the files are visible to all roles and apps, but only users with file system access, such as system administrators, can edit the files.

Use the export = system attribute to make files available to all apps in the system. In the examples above, access to commands.conf and [searchscripts] are global. If the global export under [searchscripts] is not present, the script configurations in the commands.conf file is visible in all apps, but the script files themselves are not.

Custom commands in apps that do not have a UI should be exported to the system, since there is no way to run the command in a local context.

Disable the custom command

You can use the Settings menu to disable a search command from running in an app

1. In Splunk Web, select Settings, Advanced search.

2. Click Search commands.

The Search commands page displays a table which lists the commands, information about the owner and app associated with the command, and provides options to restrict permissions and disable the command.

Note: This table only lists the search commands that are written in Python.

3. Under the Status column for the search command, click Disable.

A message banner towards the top of the window appears that confirms that the command was disabled in the app.

Enter your email address, and someone from the documentation team will respond to you:

Send me a copy of this feedback

Please provide your comments here. Ask a question or make a suggestion.

Feedback submitted, thanks!

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

Your Comment Has Been Posted Above

We use our own and third-party cookies to provide you with a great online experience. We also use these cookies to improve our products and services, support our marketing campaigns, and advertise to you on our website and other websites. Some cookies may continue to collect information after you have left our website.
Learn more (including how to update your settings) here »