Splunk Dev

How can I make a parameter optional in a modular input?

andrew207
Path Finder

I've created a modular input using the Python API. I would like to know how I can make parameters optional.

I have set hard-coded defaults in inputs.conf and in the script itself, however, the GUI add input page has all fields set to mandatory -- I would like to change this.

My scheme is defined in the python script itself, a sample is below. How can I make a parameter optional?

SCHEME = """<scheme>
    <title>SOAP Polling</title>
    <description>Get data from a SOAP Service.</description>
    <use_external_validation>true</use_external_validation>
    <streaming_mode>simple</streaming_mode>
    <endpoint>
        <args>
            <arg name="param1">
                <title>my title</title>
                <description>my description</description>
            </arg>
            <arg name="param2"> <!-- I want to make this optional -->
                <title>my title</title>
                <description>my description</description>
            </arg>
        </args>
    </endpoint>
</scheme>
"""
0 Karma
1 Solution

renjith_nair
SplunkTrust
SplunkTrust

From http://docs.splunk.com/Documentation/Splunk/6.5.1/AdvancedDev/ModInputsScripts#Define_a_scheme_for_i... , below probably should help you,

<required_on_edit>  true | false (Default is false.)

Indicates whether the parameter is required for edit. Default behavior is that arguments for edit are optional. Set this to true to override this behavior, and make the parameter required.

<required_on_create>    true | false (Default is true.)

Indicates whether the parameter is required for create. Default behavior is that arguments for create are required. Set this to false to override this behavior, and make the parameter optional. 
Happy Splunking!

View solution in original post

renjith_nair
SplunkTrust
SplunkTrust

From http://docs.splunk.com/Documentation/Splunk/6.5.1/AdvancedDev/ModInputsScripts#Define_a_scheme_for_i... , below probably should help you,

<required_on_edit>  true | false (Default is false.)

Indicates whether the parameter is required for edit. Default behavior is that arguments for edit are optional. Set this to true to override this behavior, and make the parameter required.

<required_on_create>    true | false (Default is true.)

Indicates whether the parameter is required for create. Default behavior is that arguments for create are required. Set this to false to override this behavior, and make the parameter optional. 
Happy Splunking!
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...