Splunk Search

passing host field in custom script in alert.

praneshjan
Explorer

I am trying to run a custom shell script with the hostname returned in my results. How to get the hostname field passed on to the custom script.
I tried "1.sh $result.host$" which is not working.

0 Karma

cpetterborg
SplunkTrust
SplunkTrust

Is this custom script for running from an alert?

Are you just trying to run a script or have you created a custom alert action app and you are trying to create the script? The former is being deprecated and the later is the preferred way.

If you want to send a value to the script, you will have to send it in with the results ( ... | eval hostname=thishost ) as there are no parameters that you can send on the "command line".

0 Karma
Get Updates on the Splunk Community!

Technical Workshop Series: Splunk Data Management and SPL2 | Register here!

Hey, Splunk Community! Ready to take your data management skills to the next level? Join us for a 3-part ...

Spotting Financial Fraud in the Haystack: A Guide to Behavioral Analytics with Splunk

In today's digital financial ecosystem, security teams face an unprecedented challenge. The sheer volume of ...

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability As businesses scale ...