Getting Data In

[RESOLVED] Is there a way to modify input script arguments through a setup screen (setup.xml)?

Estrellia
Explorer

Hello all,

I read some docs about how to set up a screen to allow my user to customize the inputs.conf of the application I created.

However, I can't find an answer to this question: Is there a way to change the arguments of the input script through this setup screen?

Let me explain it:

[script://$SPLUNK_HOME/etc/apps/myAppFolder/bin/scripts/myScript.sh CREDENTIALS IP_TO_REACH PORT]

Where of course credentials Ip_to_reach and Port are placeholders and need to be replaced once the app has been configured.

I would like my user to be able to modify this line to replace the credentials, Ip and port.

I read on the documentation the possibility to change the "fields" in each input but in this particular case I can't seem to find the way... I can only create a new object.
But there is nothing on how to modify it.

Thanks for your help guys, I'm a beginner so I apologize if it's an easy question.

Cheers

0 Karma
1 Solution

jconger
Splunk Employee
Splunk Employee

The "correct" way to handle situations like this is to create a modular input. Modular inputs allow you to specify parameters with a user interface. There was a great session on this at the 2015 .conf
Recording -> http://conf.splunk.com/session/2015/recordings/2015-splunk-71.mp4
Slides -> http://conf.splunk.com/session/2015/conf2015_SHaskell_Splunk_Developing_ModularInputsIfYou.pdf

In the case of setup.xml, the text between the brackets is your entity. The default setup handlers can modify fields for an entity, but you would need to use a custom setup handler to create/delete entities if you wanted to stick with a scripted input with command line parameters.

View solution in original post

jconger
Splunk Employee
Splunk Employee

The "correct" way to handle situations like this is to create a modular input. Modular inputs allow you to specify parameters with a user interface. There was a great session on this at the 2015 .conf
Recording -> http://conf.splunk.com/session/2015/recordings/2015-splunk-71.mp4
Slides -> http://conf.splunk.com/session/2015/conf2015_SHaskell_Splunk_Developing_ModularInputsIfYou.pdf

In the case of setup.xml, the text between the brackets is your entity. The default setup handlers can modify fields for an entity, but you would need to use a custom setup handler to create/delete entities if you wanted to stick with a scripted input with command line parameters.

Estrellia
Explorer

Hello,

Thank you for your help, it is indeed what I was looking for!

Cheers

0 Karma

Masa
Splunk Employee
Splunk Employee

If I were you, I would use Modular Input instead of scripted input in case I would like to have user input for custom parameters to pass to my Modular Input script. By making use of Modular Input feature, add option to let user define value for custom attribute through Settings -> Data Inputs -> Name of your custom Modular Input
(ref. http://docs.splunk.com/Documentation/Splunk/6.4.2/AdvancedDev/ModInputsIntro#Comparing_modular_input... )

Useful doc links for Modular Inputs are
https://docs.splunk.com/Documentation/Splunk/6.4.2/AdvancedDev/ModInputsBasicExample
http://dev.splunk.com/view/python-sdk/SP-CAAAER3

Estrellia
Explorer

Hello,

Thanks for your reply, I'll dig this way.

Cheers

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...