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?
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"