Skip to content

Instantly share code, notes, and snippets.

@coderofsalvation
Created July 28, 2014 09:02
Show Gist options
  • Save coderofsalvation/24f4696812aa4162328f to your computer and use it in GitHub Desktop.
Save coderofsalvation/24f4696812aa4162328f to your computer and use it in GitHub Desktop.
rsyslog multiple ommail email sample configuration
$ModLoad ommail
$ActionMailSMTPServer 127.0.0.1
$template mailSubjectMemory,"Sopflop Memory issue"
$template mailSubjectError,"Sopflop Error"
$template mailSubjectException,"Sopflop Exception"
$template mailBody,"The following event triggered this email:\r\n\r\n%msg%"
### mail on memory issue
$ActionMailFrom rsyslog@sopflop.flopsoppds.com
$ActionMailTo lk@flopsoppds.com
$ActionMailSubject mailSubjectMemory
## only works on newest rsyslog: make sure we receive a mail only once in half an hour
$ActionExecOnlyOnceEveryInterval 1800
if $msg contains 'E_ERROR Allowed memory' then :ommail:;mailBody
$ActionExecOnlyOnceEveryInterval 0
### mail on error
$ActionMailFrom rsyslog@sopflop.flopsoppds.com
$ActionMailTo lk@flopsoppds.com
$ActionMailTo gg@flopsoppds.com
$ActionMailSubject mailSubjectError
## only works on newest rsyslog: make sure we receive a mail only once in half an hour
$ActionExecOnlyOnceEveryInterval 1800
if $msg contains 'writing Full tracelog' then :ommail:;mailBody
$ActionExecOnlyOnceEveryInterval 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment