Fluent::Plugin::Sendmail

Fluentd plugin to merge sender line and receiver line into one json data.

Configuration

<source>
  type sendmail
  path /var/log/maillog
  tag sendmail
  queuereturn 60m
  path_cache_file /tmp/test.dat
</source>

example of sendmail log

Apr  2 00:15:25 mta001 sendmail[32300]: u31FFPtp032300: Milter: no active filter
Apr  2 00:15:25 mta001 sendmail[32300]: u31FFPtp032300: from=<[email protected]>, size=5938, class=0, nrcpts=5, msgid=<[email protected]>, proto=ESMTP, daemon=MTA, relay=[64.233.187.27]
Apr  2 00:15:25 mta001 sendmail[32302]: u31FFPtp032300: SMTP outgoing connect on [192.168.198.81]
Apr  2 00:15:25 mta001 sendmail[32302]: u31FFPtp032300: to=<[email protected]>,<[email protected]>, 00:00:00, xdelay=00:00:00, mailer=esmtp, pri=245938, relay=[93.184.216.34] [93.184.216.34], dsn=2.0.0, stat=Sent (ok:  Message 40279894 accepted)
Apr  2 00:15:25 mta001 sendmail[12566]: u31FFPtp032300: to=<[email protected]>, delay=00:00:15, xdelay=00:00:15, mailer=esmtp, pri=34527, relay=[93.184.216.34] [93.184.216.34], dsn=4.3.5, stat=Deferred: 451 4.3.5 Server configuration problem
Apr  2 00:15:26 mta001 sendmail[32302]: u31FFPtp032300: to=<[email protected]>,<[email protected]>, delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=245938, relay=[93.184.216.34] [93.184.216.34], dsn=2.0.0, stat=Sent (ok:  Message 40279895 accepted)
Apr  2 00:18:50 mta001 sendmail[32302]: u31FFPtp032300: to=<[email protected]>, delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=245938, relay=[93.184.216.34] [93.184.216.34], dsn=2.0.0, stat=Sent (ok:  Message 40279894 accepted)
Apr  2 00:15:25 mta001 sendmail[32302]: u31FFPtp032300: done; delay=00:00:00, ntries=2

This plugin emit record like below:

2014-01-10 01:00:01 +0900 sendmail:
{
    "time":1459523725,
    "mta":"mta001",
    "qid":"u31FFPtp032300",
    "from":"<[email protected]>",
    "size":"5938",
    "class":"0",
    "nrcpts":"7",
    "msgid":"<[email protected]>",
    "proto":"ESMTP",
    "daemon":"MTA",
    "relay":{
        "ip":"93.184.216.34",
        "host":null
    },
    "status_canonical":"sent",
    "to":[
        "<[email protected]>",
        "<[email protected]>"
    ],
    "delay":"00:00:00",
    "xdelay":"00:00:00",
    "mailer":"esmtp",
    "pri":"245938",
    "dsn":"2.0.0",
    "stat":"Sent (ok: Message 40279894 accepted)",
    "delay_in_sec":0
}

TODO

write test for path_cache_file parmeter

ChangeLog

See CHANGELOG.md for details.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Copyright (c) 2014 muddydixon. See LICENSE for details.