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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...