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!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...