<commit_before># fluent-plugin-filter-parse-postfix

Filter Plugin to parse Postfix status line log.

[![Build Status](https://travis-ci.org/winebarrel/fluent-plugin-filter-parse-postfix.svg)](https://travis-ci.org/winebarrel/fluent-plugin-filter-parse-postfix)

## Installation

Add this line to your application's Gemfile:

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

And then execute:

    $ bundle

Or install it yourself as:

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

## Configuration

```apache
<filter>
  @type parse_postfix
  #key message
  #mask true
</filter>
```

## Usage

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

<filter>
  @type parse_postfix
</filter>

<match **>
  @type stdout
</match>

$ fluentd -c fluent.conf
```

```sh
$ echo '{"message":"Feb 27 09:02:38 MyHOSTNAME postfix/smtp[26490]: 5E31727A35D: to=<<EMAIL>>, relay=gateway-f1.isp.att.net[192.168.127.12]:25, delay=0.58, delays=0.11/0.03/0.23/0.20, dsn=2.0.0, status=sent (250 ok ; id=en4req0070M63004172202102)"}' | fluent-cat test.test
#=> 2015-12-22 02:02:22 +0900 test.test: {"time":"Feb 27 09:02:38","hostname":"MyHOSTNAME","process":"postfix/smtp[26490]","queue_id":"5E31727A35D","to":"<*********<EMAIL>>","relay":"gateway-f1.isp.att.net[192.168.127.12]:25","delay":0.58,"delays":"0.11/0.03/0.23/0.20","dsn":"2.0.0","status":"sent (250 ok ; id=en4req0070M63004172202102)"}
```<commit_msg>Fix README [ci skip]<commit_after># fluent-plugin-filter-parse-postfix

Filter Plugin to parse Postfix status line log.

[![Build Status](https://travis-ci.org/winebarrel/fluent-plugin-filter-parse-postfix.svg)](https://travis-ci.org/winebarrel/fluent-plugin-filter-parse-postfix)

## Installation

Add this line to your application's Gemfile:

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

And then execute:

    $ bundle

Or install it yourself as:

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

## Configuration

```apache
<filter>
  @type parse_postfix
  #key message
  #mask true
</filter>
```

## Usage

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

<filter>
  @type parse_postfix
</filter>

<match **>
  @type stdout
</match>

$ fluentd -c fluent.conf
```

```sh
$ echo '{"message":"Feb 27 09:02:38 MyHOSTNAME postfix/smtp[26490]: 5E31727A35D: to=<<EMAIL>>, relay=gateway-f1.isp.att.net[192.168.127.12]:25, delay=0.58, delays=0.11/0.03/0.23/0.20, dsn=2.0.0, status=sent (250 ok ; id=en4req0070M63004172202102)"}' | fluent-cat test.test
#=> 2015-12-22 02:02:22 +0900 test.test: {"time":"Feb 27 09:02:38","hostname":"MyHOSTNAME","process":"postfix/smtp[26490]","queue_id":"5E31727A35D","to":"<*********<EMAIL>>","domain":"myemail.net","relay":"gateway-f1.isp.att.net[192.168.127.12]:25","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

```json
{
  "time":"Feb 27 09:02:38",
  "hostname":"MyHOSTNAME",
  "process":"postfix/smtp[26490]",
  "queue_id":"5E31727A35D",
  "to":"<*********<EMAIL>>",
  "domain":"myemail.net",
  "relay":"gateway-f1.isp.att.net[192.168.127.12]:25",
  "delay":0.58,
  "delays":"0.11/0.03/0.23/0.20",
  "dsn":"2.0.0",
  "status":"sent",
  "status_detail":"(250 ok ; id=en4req0070M63004172202102)"
}
```
{'fraction_non_alphanumeric': 0.21744360902255638, 'fraction_numerical': 0.12360902255639097, 'mean_word_length': 5.205223880597015, 'pattern_counts': {'":': 36, '<': 29, '<?xml version=': 0, '>': 31, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 5, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1608216', 'n_tokens_mistral': 1618, 'n_tokens_neox': 1356, 'n_words': 208}