Splunk Search

How to execute a shell script kept in app's bin folder using a dashboard?

somesoni2
Revered Legend

I have a requirement to execute a script (does file cleanup) to be executed from a dashboard button (so as to avoid login into unix box to execute it, it has to be executed on adhoc manner). The shell script is placed in etc/apps/MyApp/bin folder.

I looked though similar question (http://answers.splunk.com/answers/68392/trigger-shell-script-from-dashboard-button) but couldn't figure out how to execute shell script from that.

Has anyone done that and can share pointers/samples?

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

You could define your cleanup script as a custom generating search command, and have the button trigger a search for | cleanup, possibly while passing some parameters and output to be displayed in the dashboard.
Another upside to this approach is you could easily have Splunk schedule a cleanup if needed... and even test whether cleanup is necessary first: some search returning one result if cleanup is necessary, zero results if it is not | map search="cleanup"

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...