Alerting

How to use SMTP AUTH for action.email.mailserver emails?

mashery
Engager

I need alert emails generated by saved search monitors to be delivered via an email server that requires SMTP Authentication.

How can I specify SMTP AUTH credentials with action.email.* values?

araitz
Splunk Employee
Splunk Employee

SMTP authentication should be possible in Splunk 4.2.

the_wolverine
Champion

GERALD,

Can you post a sample sendemail.py script that has been modified to do SMTP AUTH?

Thank you.

0 Karma

gkanapathy
Splunk Employee
Splunk Employee

No, I can't. But it's just a matter of getting the credentials, then inserting a call to smtp.login() http://docs.python.org/library/smtplib.html#smtplib.SMTP.login after creating the smtp in the line smtp = smtplib.SMTP(serverURL).

0 Karma

gkanapathy
Splunk Employee
Splunk Employee

There are a couple of ways to do this:

  • You could customize and modify the sendemail.py python script that actually does the sending. The original is located in $SPLUNK_HOME/etc/apps/search/bin/. Rather than modifying the delivered file directly though (it will get clobbered on updates), you can create a version with a different name and either: override [sendemail] in etc/apps/search/default/commands.conf with a local .conf file, which will make Splunk just use the new version; or create a new commands.conf entry and override the command setting in the [email] stanza in etc/system/default/alert_actions.conf.
  • Another way that some prefer is to leave Splunk unmodified and configure your own SMTP server (e.g., one that is already running on the Splunk server) to authenticate to and relay all mail to the desired authentication-requiring SMTP server, leave yours to accept mail with no authentication, and have Splunk send messages to this local server. (You'll want to make sure your server is reachable only locally in this case.) You would follow instructions to set up your local SMTP server to perform SASL authentication to the desired outbound relay. A couple of simple examples with sendmail and postfix are here: http://www.screaming-penguin.com/node/4214 and here: http://www.riverturn.com/blog/?p=239
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!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...