Alerting

restarting application(s) from alert

rainhailrob
Path Finder

I have the search and alert working and my script will run if I execute it locally, but since the script is running from the Heavy Forwarder I can't get the application(s) to start.

runas /profile /env "C:\Program Files (x86)\Notepad++.exe" >> test-restart.txt
runas /profile /env "C:\Program Files (x86)\putty\putty.exe" >> test-restart.txt

I was trying to get these simple applications to run before working on the production applications. I also wanted to email the log success or failure of the application(s) start.

I did run the following:
index=windows host=testserver sourcetype="WinEventLog:Application" EventCode=1000 Type=Warning "Faulting Application name: Test123" | runshellscript Test-Application-restart.bat

Here was the output of the above search:
External search command 'runshellscript' returned error code 1. Script output= "ERROR "Missing arguments to operator 'runshellscript', expected at least 10, go 2." "

0 Karma

lguinn2
Legend

I have never seen this error message, but I think there is a more basic problem here - if I understand your question correctly.

An alert executes a script as the result of a search. Therefore, the alert script must exist on the search head (or the indexer if there is no separate search head). And the alert script will be executed on the search head.

So it isn't going to work if the script is on the forwarder (whether it is a heavy forwarder or not).

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 ...