Getting Data In
Highlighted

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

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://$SPLUNKHOME/etc/apps/myAppFolder/bin/scripts/myScript.sh CREDENTIALS IPTO_REACH PORT]

Where of course credentials Iptoreach 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
Highlighted

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

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

Highlighted

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

Explorer

Hello,

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

Cheers

0 Karma
Highlighted

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

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

Highlighted

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

Explorer

Hello,

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

Cheers

0 Karma