Dashboards & Visualizations

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

aayushisplunk1
Path Finder

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

DavidHourani
Super Champion

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
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 ...