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. 
---
What goes around comes around. If it helps, hit it with Karma 🙂

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. 
---
What goes around comes around. If it helps, hit it with Karma 🙂
Get Updates on the Splunk Community!

Splunk App for Anomaly Detection End of Life Announcement

Q: What is happening to the Splunk App for Anomaly Detection?A: Splunk is officially announcing the ...

Aligning Observability Costs with Business Value: Practical Strategies

 Join us for an engaging Tech Talk on Aligning Observability Costs with Business Value: Practical ...

Mastering Data Pipelines: Unlocking Value with Splunk

 In today's AI-driven world, organizations must balance the challenges of managing the explosion of data with ...