Dashboards & Visualizations

Using HTML to execute a cURL command


Hello all,

My ultimate goal is to have a button (or buttons) on a Splunk dashboard which will inform other users when they have left their desk.

my current method is to add a clickable button using HTML on a HTML converted dashboard which will execute a cURL command. The cURL command is used to send data via the HTTP Event Collector to an index which would have the latest status of each user. I am able to execute the cURL command just fine with what I have below in the CLI:

curl -k https://<HOST>:8088/services/collector -H 'Authorization: Splunk <TOKEN>' -d '{"sourcetype": "cURL", "event":"name=JOHN location=WEST status=OUT"}'

I've attempted to convert the cURL command to an HTML form for the dashboard but what I'm using doesn't pass the HEC token properly:

 <form ref='uploadForm' 
    <input type='hidden' type="location" name="West" value="West" />
    <input type='hidden' type="name" name="John" value="John" />
    <input type='hidden' type="status" name="Out" value="Out" />
    <input type='submit' value='John is out' />

When using the above HTML, I get the following error:

{"text":"Token is required","code":2}

Any guidance on how to pass the HEC token or a more efficient method would be greatly appreciated.

0 Karma

New Member

This link could be of some use to embed curl command to HTML.

0 Karma
Get Updates on the Splunk Community!

Splunk Forwarders and Forced Time Based Load Balancing

Splunk customers use universal forwarders to collect and send data to Splunk. A universal forwarder can send ...

NEW! Log Views in Splunk Observability Dashboards Gives Context From a Single Page

Today, Splunk Observability releases log views, a new feature for users to add their logs data from Splunk Log ...

Last Chance to Submit Your Paper For BSides Splunk - Deadline is August 12th!

Hello everyone! Don't wait to submit - The deadline is August 12th! We have truly missed the community so ...