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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...