Archive
Highlighted

can we pass token values from a dashboard as parameters to python script being used as a data input ?

Explorer

i have added an input as a drop down in a dashboard. I want to use the token value for the selected item from the drop down to be passed a parameter to a python script , which i have added as a local script from the "Add Inputs" option.
Is it possible to pass tokens as parameters to the python script (being used as a data input) ?
If yes, how can we do that ?

Tags (1)
0 Karma
Highlighted

Re: can we pass token values from a dashboard as parameters to python script being used as a data input ?

SplunkTrust
SplunkTrust

Hi @aayushisplunk1,

There is no clean way to do this, but it can be done as follows.

First of all you will need to define a custom search command that allows you to modify the specific script under bin in your app with the token parameter. Let's call this command "passValue" and make it take one parameter. So to call your script you would call it like this : | passValue value
See here for creating custom search commands :http://dev.splunk.com/view/SP-CAAAFFT

Once you got that custom command ready. You can easily make the dashboard you mentioned in your question using this logic :

1- User selects token.
2- User hits submit.
3- One of the panels contains the | passValue $value$ command with the token. So once the submit button is hit, the script will do it's charm and modify your scripted inputs.
4- Next time the scripted inputs run, it will use the new script with the modified value from the token.

Cheers,
David

0 Karma