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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...