No commit activity in last 3 years
No release in over 3 years
Filter Plugin to parse Postfix status line log.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 3.0.0
>= 3.1.0

Runtime

 Project Readme

fluent-plugin-filter-parse-postfix

Filter Plugin to parse Postfix status line log.

Build Status

Installation

Add this line to your application's Gemfile:

gem 'fluent-plugin-filter-parse-postfix'

And then execute:

$ bundle

Or install it yourself as:

$ gem install fluent-plugin-filter-parse-postfix

Configuration

<filter>
  @type parse_postfix
  #key message
  #mask true
  #use_log_time false
  #include_hash false
  #salt my_salt
  #sha_algorithm 512 # 1, 224, 256, 384, 512 (default)
  #parse_header_checks false
</filter>

Usage

$ cat fluent.conf
<source>
  @type forward
</source>

<source>
  @type tail
  path /var/log/maillog
  pos_file /var/log/td-agent/postfix-maillog.pos
  tag postfix.maillog
  format none
</source>

<filter postfix.maillog>
  @type grep
  regexp1 message status=
</filter>

<filter postfix.maillog>
  @type parse_postfix
</filter>

<match postfix.maillog>
  @type stdout
</match>

$ fluentd -c fluent.conf
$ echo '{"message":"Feb 27 09:02:38 MyHOSTNAME postfix/smtp[26490]: 5E31727A35D: to=<bellsouth@myemail.net>, relay=gateway-f1.isp.att.net[204.127.217.17]:25, conn_use=2, delay=0.58, delays=0.11/0.03/0.23/0.20, dsn=2.0.0, status=sent (250 ok ; id=en4req0070M63004172202102)"}' | fluent-cat postfix.maillog
#=> 2015-12-22 02:02:22 +0900 postfix.maillog: {"time":"Feb 27 09:02:38","hostname":"MyHOSTNAME","process":"postfix/smtp[26490]","queue_id":"5E31727A35D","to":"<*********@myemail.net>","domain":"myemail.net","relay":"gateway-f1.isp.att.net[204.127.217.17]:25","conn_use":2,delay":0.58,"delays":"0.11/0.03/0.23/0.20","dsn":"2.0.0","status":"sent","status_detail":"(250 ok ; id=en4req0070M63004172202102)"}

Output

see https://github.com/winebarrel/postfix_status_line

{
  "time":"Feb 27 09:02:38",
  "hostname":"MyHOSTNAME",
  "process":"postfix/smtp[26490]",
  "queue_id":"5E31727A35D",
  "to":"*********@myemail.net",
  "domain":"myemail.net",
  "relay":"gateway-f1.isp.att.net[204.127.217.17]:25",
  "conn_use":2,
  "delay":0.58,
  "delays":"0.11/0.03/0.23/0.20",
  "dsn":"2.0.0",
  "status":"sent",
  "status_detail":"(250 ok ; id=en4req0070M63004172202102)"
}
$ cat fluent.conf
...
<filter postfix.maillog>
  @type grep
  regexp1 message warning: header
</filter>

<filter postfix.maillog>
  @type parse_postfix
  parse_header_checks true
</filter>
...

$ fluentd -c fluent.conf
$ echo '{"message":"Mar  4 14:44:19 P788 postfix/cleanup[7426]: E80A9DF6F7E: warning: header Subject: test from local; from=<sugawara@P788.local> to=<sgwr_dts@yahoo.co.jp>"}' | fluent-cat postfix.maillog
#=> 2017-03-04 18:26:46.146399000 +0900 postfix.maillog: {
#     "time":"Mar  4 14:44:19",
#     "hostname":"P788",
#     "process":"postfix/cleanup[7426]",
#     "queue_id":"E80A9DF6F7E",
#     "to":"********@yahoo.co.jp",
#     "domain":"yahoo.co.jp",
#     "from":"********@P788.local",
#     "header_from":"local",
#     "priority":"warning",
#     "Subject":"test"}