Splunk Enterprise

How to send curl request from Splunk dashboard?

mottig
Path Finder

Hi,

I am  a new to spunk.

I am trying to send an REST request from splunk dashboard by a submit button to external server that listens http requests.

How can i achieve that goal? I basically need to send a simple curl with a var in the path that will be selected by the user from a drop down list.

 

 

Labels (1)
0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

That is exactly what you can do with the add on. 

Effectively the button can set a token and then the SPL containing the curl command can execute and notify your backend server to perform whatever you need it to.

In Splunk everything is a search, so you will just have a hidden search that is dependent on the token that can be set by the button. Clicking the button will set the token, causing the SPL to run.

See the Custom Token Links example in the Splunk Dashboard Examples app, which shows you how to do buttons/tokens.

Then your SPL would be something like this, where the curl_button_token token is set by the button and cleared again when the search has run.

<search depends="$curl_button_token$">
  <query>
| curl ...
  </query>
  <done>
    <unset token="curl_button_token"></unset>
  </done>
</search>

 

View solution in original post

bowesmana
SplunkTrust
SplunkTrust

Take a look at this addon

https://splunkbase.splunk.com/app/4146/

 

0 Karma

mottig
Path Finder

Thank you for your answer.

Im not sure this addon is what I need.

This addon is allowing to have curl sending abilities in SPL. I need to send an API from a button in a dashboard

that is not related to to the data.

For example I want to notify my backend server to start send me events from a certain type(that will be define as a strings in another drop down list).

0 Karma

bowesmana
SplunkTrust
SplunkTrust

That is exactly what you can do with the add on. 

Effectively the button can set a token and then the SPL containing the curl command can execute and notify your backend server to perform whatever you need it to.

In Splunk everything is a search, so you will just have a hidden search that is dependent on the token that can be set by the button. Clicking the button will set the token, causing the SPL to run.

See the Custom Token Links example in the Splunk Dashboard Examples app, which shows you how to do buttons/tokens.

Then your SPL would be something like this, where the curl_button_token token is set by the button and cleared again when the search has run.

<search depends="$curl_button_token$">
  <query>
| curl ...
  </query>
  <done>
    <unset token="curl_button_token"></unset>
  </done>
</search>

 

chaker
Contributor

Without fully understanding what you are trying to achieve, you can try using the solution below to run the SPL command that @bowesmana suggested add-on offers, or perhaps this may give you other ideas to solve the problem.

https://community.splunk.com/t5/Dashboards-Visualizations/Button-to-run-splunk-query/m-p/454739/high...

 

 

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!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...