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
Legend

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
Legend

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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...