Getting Data In

Running a script via a button call

rohithvr19
Loves-to-Learn Everything

Is it possible to execute a script through a button click and display the script's output on a Splunk dashboard? Has anyone implemented something similar before? Any guidance would be greatly appreciated, as I am currently stuck on this. Thank you!

Labels (2)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

1. You're posting this one in a "Getting data in" section with "HEC" and "scripted input" labels. Are you sure it's really about getting data into your Splunk?

2. What kind of script are you talking about? A JS code in your browser? A script on the Search Head? Something else?

3. Are you aware of the security implications?

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @rohithvr19 ,

as I said in my answer to yourp revious question it's possible, but think to your requirements, because the performance of a script button will be very very low and the better approach isn't the script execution with a button, but a near real time scheduled search, as described in https://community.splunk.com/t5/Splunk-Search/Export-Logs-from-Zabbix-to-Splunk-Dashboard-via-API-on...

Ciao.

Giuseppe

0 Karma

oO0NeoN0Oo
Loves-to-Learn Lots

Hi bud,

Have you tried creating a <p> on the dashboard and telling the script to display it?

<dashboard version="1.1" script="my_js.js">
<label>My JS Output</label>
<row>
<panel>
<html>
<input type="button" value="Submit" id="submitButton" />
<h1>This is my output<h1>
<p id="my_script_output"></p
</html>
</panel>
</row>
</dashboard>

Then your js:

document.getElementById("submitButton").addEventListener("click", output);
function(output() {
let script_output = "This is my Output."
document.getElementById("my_script_output").innerHTML = script_output;
}

Does depend on how complex you want it to be...

Let me know how you get on with this 👍

Regards

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@rohithvr19 

Please check my answer below.

https://community.splunk.com/t5/Dashboards-Visualizations/Can-I-call-a-Python-script-from-a-dashboar...

 

Thanks
KV
An upvote would be appreciated if any of my replies help you solve the problem or gain knowledge.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Cisco Data Fabric from Architecture to Investigation, Better SOC Visibility, and More ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

The Trust Gap: Why a Data Foundation is Fundamental to an Agentic Enterprise

The Trust Gap: Why a data foundation is fundamental to an  Agentic Enterprise.   Agentic AI is transforming ...

Data Management Digest – September 2026

    Welcome to the September 2026 edition of Data Management Digest! September brought a fresh wave of ...