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
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: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

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

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