Dashboards & Visualizations
Highlighted

Call custom command on drilldown from a dashboard.

Explorer

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
Highlighted

Re: Call custom command on drilldown from a dashboard.

Contributor

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
Highlighted

Re: Call custom command on drilldown from a dashboard.

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.




| eval message="Happy Splunking!!!"


0 Karma
Highlighted

Re: Call custom command on drilldown from a dashboard.

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