Splunk Search

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

somesoni2
SplunkTrust
SplunkTrust

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 | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...