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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...