Dashboards & Visualizations

Call custom command on drilldown from a dashboard.

bhupalbobbadi
Path Finder

Hello Splunk Developers
I need to call a custom command on click of a drilldown on a table cell in dashboard. The action should call the custom command behind the screen and upon completion of command execution should be able to update another cell in the table.

Have anybody came across this kind of requirement and able to code the requirement? Any guide/help is appreciated. Thanks in Advance.

0 Karma

santosh11
New Member

We can use html dashboard for this.

We trigger a dropdown change event.
you get the value and by using that you can trigger a search or a oneshot query
and on success of the search you can get the value and update the other cell.

Regards,
Santosh

0 Karma

niketn
Legend

@bhupalbobbadi the token you set from table drilldown can be passed on to an independent search with dummy dependency which can run your custom command. On completion of that independent search you can set another token through <done> search event handler, which would add a dummy dependency back to the table to refresh the same.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

ololdach
Builder

Hi, that's an interesting challenge. The click on the table can easily be intercepted by JavaScript. If the code that you need to run should be executed on the client, implement it in a custom .js. I assume, however, that you'd want to execute the code on a server (possibly the splunk server itself). In that case, you need to have some sort of REST endpoint on the server that gets called through the URL that you put inside the drilldown link. The call to the REST then runs your script on the server. If it's the splunk server you want to use, take a look at: https://answers.splunk.com/answers/730196/how-to-make-a-custom-rest-endpoint-in-splunk.html
After the code executes, return a HTML redirect from the REST call to the client back to the page/URL that you came from, resulting in the refresh of the dashboard.

0 Karma
Get Updates on the Splunk Community!

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 ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...