fluent-plugin-amplifier-filter 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |gem|
3
3
  gem.name = "fluent-plugin-amplifier-filter"
4
- gem.version = "0.1.0"
4
+ gem.version = "0.1.1"
5
5
  gem.authors = ["TAGOMORI Satoshi"]
6
6
  gem.email = ["tagomoris@gmail.com"]
7
7
  gem.summary = %q{plugin to re-emit messages with amplified values}
@@ -69,22 +69,34 @@ class Fluent::AmplifierFilterOutput < Fluent::Output
69
69
  end
70
70
  end
71
71
 
72
+ pairs = []
72
73
  if @key_names
73
74
  es.each {|time,record|
75
+ updated = {}
74
76
  @key_names.each {|key|
75
- record[key] = amp(record[key]) if record[key]
77
+ val = record[key]
78
+ next unless val
79
+ updated[key] = amp(val)
76
80
  }
77
- Fluent::Engine.emit(tag, time, record)
81
+ if updated.size > 0
82
+ pairs.push [time, record.merge(updated)]
83
+ end
78
84
  }
79
85
  else @key_pattern
80
86
  es.each {|time,record|
87
+ updated = {}
81
88
  record.keys.each {|key|
82
- next unless record[key] and @key_pattern.match(key)
83
- record[key] = amp(record[key])
89
+ val = record[key]
90
+ next unless val
91
+ next unless @key_pattern.match(key)
92
+ updated[key] = amp(val)
84
93
  }
85
- Fluent::Engine.emit(tag, time, record)
94
+ if updated.size > 0
95
+ pairs.push [time, record.merge(updated)]
96
+ end
86
97
  }
87
98
  end
99
+ Fluent::Engine.emit_array(tag, pairs)
88
100
 
89
101
  chain.next
90
102
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-amplifier-filter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-04 00:00:00.000000000 Z
12
+ date: 2012-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd