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
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...