fluent-plugin-filter-parse-postfix 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37eda6a4725a2b13124c2242f4ef26f0fc19cd2f
4
- data.tar.gz: d52117edbd2e7edc6331aeb6b0ef9781182658a9
3
+ metadata.gz: ddb8c7b56b48d1cba9c71c03278a6b99c1ae46bf
4
+ data.tar.gz: 4bdb2cb0f81c2d58db582cf54223ef081c016895
5
5
  SHA512:
6
- metadata.gz: b175aaa5c2a82f00997969623af093adc58545dc47bc1451923dc2dd16e6c7d755d48e6b76a810af3fac2ac6046e5569dde53f70f9ad08ed1ab1b37f86b50c08
7
- data.tar.gz: d3925399eef8d58cde6447011233ec1db6430a5185a58089ec60ed4f154f2b07d40c74f799ccbd5cbe32f832ebdfd3e1a9dce1f27d7ff2b773e7ed942c673e8c
6
+ metadata.gz: 055206a8afaacad30a2d2ea40c1139821c31f862bb76638bb824963b5b1fce356b31dc6c7e38bc738ab866ea539f7b7feb2439488a2b400157ac6a5708b2bdf0
7
+ data.tar.gz: 0f49c00c18813bc3070eb4b7bf28963668df948b4a4b04b6e2f7d9f2ee384bfd0c4f9342c15b00831dae8031be268edc8f8d936c5e58d38bf20fcf3592f83197
data/README.md CHANGED
@@ -41,11 +41,24 @@ $ cat fluent.conf
41
41
  @type forward
42
42
  </source>
43
43
 
44
- <filter>
44
+ <source>
45
+ @type tail
46
+ path /var/log/maillog
47
+ pos_file /var/log/td-agent/postfix-maillog.pos
48
+ tag postfix.maillog
49
+ format none
50
+ </source>
51
+
52
+ <filter postfix.maillog>
53
+ @type grep
54
+ regexp1 message status=
55
+ </filter>
56
+
57
+ <filter postfix.maillog>
45
58
  @type parse_postfix
46
59
  </filter>
47
60
 
48
- <match **>
61
+ <match postfix.maillog>
49
62
  @type stdout
50
63
  </match>
51
64
 
@@ -53,8 +66,8 @@ $ fluentd -c fluent.conf
53
66
  ```
54
67
 
55
68
  ```sh
56
- $ 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 test.test
57
- #=> 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":"<*********@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)"}
69
+ $ 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
70
+ #=> 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)"}
58
71
  ```
59
72
 
60
73
  ## Output
@@ -20,9 +20,6 @@ module Fluent
20
20
  end
21
21
 
22
22
  result_es
23
- rescue => e
24
- log.warn e.message
25
- log.warn e.backtrace.join(', ')
26
23
  end
27
24
 
28
25
  private
@@ -34,7 +31,7 @@ module Fluent
34
31
  parsed = PostfixStatusLine.parse(line,mask: @mask, hash: @include_hash, salt: @salt)
35
32
 
36
33
  unless parsed
37
- log.warn "Could not parse a postfix log: #{line}"
34
+ log.warn "cannot parse a postfix log: #{line}"
38
35
  return
39
36
  end
40
37
 
@@ -43,6 +40,9 @@ module Fluent
43
40
  end
44
41
 
45
42
  result_es.add(time, parsed)
43
+ rescue => e
44
+ log.warn "failed to parse a postfix log: #{line}", :error_class => e.class, :error => e.message
45
+ log.warn_backtrace
46
46
  end
47
47
  end
48
48
  end
@@ -1,3 +1,3 @@
1
1
  module FluentPluginFilterParsePostfix
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-filter-parse-postfix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara