[syslog-ng] [PATCH]: Experimental SMTP destination

Robert Fekete frobert at balabit.com
Sat Feb 12 20:07:24 CET 2011


On 02/12/2011 05:12:55 PM, Gergely Nagy wrote:
> Hi!
> 
> I've had a little free time, and started toying with the idea of
> implementing an SMTP destination for syslog-ng. So far, it's
> progressing
> nicely, but there are a few shortcomings, as I will explain later.
> 
> For anyone interested, it can be found on the 'work/modules/afsmtp'
> branch of my syslog-ng-3.3 tree:
> 
>   git://git.balabit.hu/algernon/syslog-ng-3.3.git
> 
> Or, one can browse the branch on the web:
> 
>   http://git.balabit.hu/?p=algernon/syslog-
> ng-3.3.git;a=shortlog;h=work/modules/afsmtp
> 
> One will need the libesmtp library installed for the module to work.
> It
> should be available in most distributions, but if one doesn't have 
> it,
> it can be downloaded from http://www.stafford.uklinux.net/libesmtp/
> (although, as of this writing, the site seems to be down).
> 
> The usage is something like this:
> 
>         destination d_smtp {
>           smtp(
>             host("localhost")
>             port(25)
>             mail_from("syslog-ng alert service 
> <noreply at example.com>")
>             rcpt_to("Admin #1 <admin at example.com>")
>             rcpt_to("Admin #2 <admin2 at example.com>")
>             subject("[ALERT] $LEVEL condition in $PROGRAM!")
>             header("X-Program" "$PROGRAM")
>             header("X-Facility" "$FACILITY")
>             body("Hi!\nThe syslog-ng alerting service thinks you 
> might
> be interested in the following message:\n $MSG\n-- \nsyslog-ng\n")
>           );
>         };
> 
> One can specify any number of recipients, and the mail will be sent 
> to
> all of them. Custom headers can also be specified, but at this time, 
> a
> selected few headers do not work as one would expect, due to libesmtp
> handling them specially.
> 
> These are: Date, From, To, Cc, Bcc, Reply-To - trying to set either 
> of
> these will result in unspecified behaviour (ranging from mangled
> headers
> to crashes, in case of Date). I will fix these at a later point. They
> will probably be need to set via their own statements (header_date,
> header_from, etc, or something along those lines).
> 
> Specifying mail_from or subject multiple times will override any
> previous values. Adding the same custom header multiple times will
> only
> add the first (though, plans include changing that, so that one can
> include the same header multiple times, with different values - if I
> can
> find a use-case for that).
> 
> There are also a few other minor issues here and there, but nothing
> major, as far as I could check.
> 
> Further plans include authentication & starttls support. libesmtp
> supports both, I just didn't have time to write the neccessary glue
> code
> yet.

Authentication & starttls are nice things, but making e-mail sending 
available as patterndb actions would be much cooler, IMHO. (Even though 
there is probably a workaround for it even with this driver.)

Nice work!

Robert

> 
> -- 
> |8]
> 
> 
> 
> ______________________________________________________________________________
> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
> Documentation: http://www.balabit.com/support/documentation/?
> product=syslog-ng
> FAQ: http://www.campin.net/syslog-ng/faq.html
> 
> 
> 






More information about the syslog-ng mailing list