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.

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...