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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...