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 +4 -4
- data/README.md +17 -4
- data/lib/fluent/plugin/filter_parse_postfix.rb +4 -4
- data/lib/fluent_plugin_filter_parse_postfix/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddb8c7b56b48d1cba9c71c03278a6b99c1ae46bf
|
4
|
+
data.tar.gz: 4bdb2cb0f81c2d58db582cf54223ef081c016895
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
<
|
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
|
57
|
-
#=> 2015-12-22 02:02:22 +0900
|
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 "
|
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
|