fluent-plugin-filter-parse-postfix 0.1.3 → 0.1.5

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: ecf322411d52500e3e8969e2c825bb33d7ed736d
4
- data.tar.gz: acb9d3a55867c31027222010676b79f0f72a88c0
3
+ metadata.gz: 82e38fcbca9cff3bbca98ae1fb7ac3d99ff2cd44
4
+ data.tar.gz: e4541345ef6a5469f2e8b089bbaf194c36e8758c
5
5
  SHA512:
6
- metadata.gz: b441a189cf17cf86386e80100919a3539962579aad891d62cd0de72d4e93cedc6d39959abd94977f84f93d7feea445f267bcec7b6dd9e1d60e6154617a27cde2
7
- data.tar.gz: 37a1bdc44b362f953ba4d82794e30dbbe6208903302c438339dd444a58d95c96bb8904ebc1c4197bf54aebd98591628cc119d2d6691274bf83cf8d804f1fe947
6
+ metadata.gz: 3b3890c9eb6060dd1baf5e9aea924220ac29887beb76fcf97693ec18ee935a06bf03a916ca7ab511453ac2f0b9b68b4dfb8280b24850ba24ff105dc9cd48cee5
7
+ data.tar.gz: e53c51e56dc7a7034919f005275972af2c81c21cf2f466f8b12544582fa1b68e59b7d47d1d4536ddd6019d46ef7edb3969fa75248b7ca5eca1ac1dd7d2d9706d
data/README.md CHANGED
@@ -27,6 +27,7 @@ Or install it yourself as:
27
27
  @type parse_postfix
28
28
  #key message
29
29
  #mask true
30
+ #use_log_time false
30
31
  </filter>
31
32
  ```
32
33
 
@@ -51,7 +52,7 @@ $ fluentd -c fluent.conf
51
52
 
52
53
  ```sh
53
54
  $ 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, 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
54
- #=> 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","delay":0.58,"delays":"0.11/0.03/0.23/0.20","dsn":"2.0.0","status":"sent","status_detail":"(250 ok ; id=en4req0070M63004172202102)"}
55
+ #=> 2015-12-22 02:02:22 +0900 test.test: {"time":1424995358,"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","delay":0.58,"delays":"0.11/0.03/0.23/0.20","dsn":"2.0.0","status":"sent","status_detail":"(250 ok ; id=en4req0070M63004172202102)"}
55
56
  ```
56
57
 
57
58
  ## Output
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ['lib']
21
21
 
22
22
  spec.add_dependency 'fluentd', '>= 0.12'
23
- spec.add_dependency 'postfix_status_line', '>= 0.1.4'
23
+ spec.add_dependency 'postfix_status_line', '>= 0.1.6'
24
24
 
25
25
  spec.add_development_dependency 'bundler'
26
26
  spec.add_development_dependency 'rake'
@@ -1,12 +1,14 @@
1
1
  require 'fluent_plugin_filter_parse_postfix/version'
2
2
  require 'postfix_status_line'
3
+ require 'time'
3
4
 
4
5
  module Fluent
5
6
  class ParsePostfixFilter < Filter
6
7
  Plugin.register_filter('parse_postfix', self)
7
8
 
8
- config_param :key, :string, :default => 'message'
9
- config_param :mask, :bool, :default => true
9
+ config_param :key, :string, :default => 'message'
10
+ config_param :mask, :bool, :default => true
11
+ config_param :use_log_time, :bool, :default => false
10
12
 
11
13
  def filter_stream(tag, es)
12
14
  result_es = Fluent::MultiEventStream.new
@@ -34,6 +36,10 @@ module Fluent
34
36
  return
35
37
  end
36
38
 
39
+ if @use_log_time and parsed['time']
40
+ time = Time.parse(parsed['time']).to_i
41
+ end
42
+
37
43
  result_es.add(time, parsed)
38
44
  end
39
45
  end
@@ -1,3 +1,3 @@
1
1
  module FluentPluginFilterParsePostfix
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.5'
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.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '>='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.1.4
33
+ version: 0.1.6
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.1.4
40
+ version: 0.1.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement