Alerting

Email Alert Subject

kbecker
Communicator

Is it possible to add data from a search to the subject line of an email alert? Currently the subject defaults to the name of the saved search, I would also like to append the host name to the subject that generated the alert. It looks like this would be configured in saved_searches.conf by using the action.email.subject parameter, I just do not know if it is possible to pass search results to it or how this would be done?

Thanks in advance for any help...

Tags (2)
1 Solution

jrodman
Splunk Employee
Splunk Employee

You can see what the script will do with the resulting string by popping open sendemail.py. I don't think the string has any variable expansion etc applied to it before passing the string along.

If you run your searches in your own app, it could supply its own (modfied) sendemail searchscript to override the behavior. There's some downsides there (field extractions, tags may not be available in that app). Alternatively, you could just use a different alert script instead of the built-in emailing facility. Either way you get control over the behavior.

I'm not sure what a more flexible email control interface looks like. Ideally, I think you'd want it to tie into the the search language flexibility.

There's definitely some ER here of some kind. If the question is something like 'which of my 80 splunk instances is responsible for this search?' then we should maybe wire in some defaults.

View solution in original post

Jason
Motivator

As of 4.1.4, you can edit the subject line via the Web Manager interface at <splunk web address>/en-US/manager/search/configs/conf-alert_actions/email?action=edit

0 Karma

parallaxed
Path Finder

Echoing the previous answer, writing a script of your own to craft the email sounds like a better solution. The arguments that are given to scripted alerts are listed in the docs:

http://www.splunk.com/base/Documentation/3.1.1/Admin/SetUpAlerts#Script_options

jrodman
Splunk Employee
Splunk Employee

You can see what the script will do with the resulting string by popping open sendemail.py. I don't think the string has any variable expansion etc applied to it before passing the string along.

If you run your searches in your own app, it could supply its own (modfied) sendemail searchscript to override the behavior. There's some downsides there (field extractions, tags may not be available in that app). Alternatively, you could just use a different alert script instead of the built-in emailing facility. Either way you get control over the behavior.

I'm not sure what a more flexible email control interface looks like. Ideally, I think you'd want it to tie into the the search language flexibility.

There's definitely some ER here of some kind. If the question is something like 'which of my 80 splunk instances is responsible for this search?' then we should maybe wire in some defaults.

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...