fluentd 0.12.9 → 0.12.10

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 389d806680686ce59ee87528aeb56c6bb3eabe92
4
- data.tar.gz: 7756ef8d28122b38f3ded3413a1735f664926117
3
+ metadata.gz: 1713e75f8506de5f6b0536fad50320386c836d66
4
+ data.tar.gz: 4b8f4e7728086788c62f2f88b3e45e4ef93d0ccd
5
5
  SHA512:
6
- metadata.gz: a1e17c1773eb0e805352862b6bc76a051aaa6ff257c5acef32fa244de245d9d67e261824c939187a76b22146c87a288494c9b31e92df176a4f910008f6ef198c
7
- data.tar.gz: 07c21ddcdbf4d140e6151d60187b951a909e9269a48f037e18e7f5f43dc5f45cc2a42ea55ac538af1d36d42d0a273acdeed01f4835342163cd6893d7922d1d3b
6
+ metadata.gz: 72b4a8dd05fc897004a0313a37fcd2d931723a449dee05b8c6682ceba49ac539cad4dec1cd9ca90fae6563fd1a2893d96de2e7df20248014a5f9da6c416afb03
7
+ data.tar.gz: c6d11c5e0958a43f8edef4a8ff508687291e02749b850c84f88baae3ef1f78bcf84074718e63b681b0da26decf360d4303063381d894d47eff4ea1f185cfcc81
data/ChangeLog CHANGED
@@ -1,5 +1,14 @@
1
1
  # v0.12
2
2
 
3
+ ## Release 0.12.10 - 2015/05/28
4
+
5
+ ### New features / Enhancement
6
+
7
+ * filter_record_transformer: add renew_time_key option to replace event time with processed field
8
+ https://github.com/fluent/fluentd/pull/602
9
+ * config: add config_param `enum` type
10
+ https://github.com/fluent/fluentd/pull/600
11
+
3
12
  ## Release 0.12.9 - 2015/05/19
4
13
 
5
14
  ### New features / Enhancement
@@ -67,6 +67,15 @@ module Fluent
67
67
  val
68
68
  })
69
69
 
70
+ Configurable.register_type(:enum, Proc.new { |val, opts|
71
+ s = val.to_sym
72
+ raise "Plugin BUG: config type 'enum' requires :list argument" unless opts[:list].is_a?(Array)
73
+ unless opts[:list].include?(s)
74
+ raise ConfigError, "valid options are #{opts[:list].join(',')} but got #{val}"
75
+ end
76
+ s
77
+ })
78
+
70
79
  Configurable.register_type(:integer, Proc.new { |val, opts|
71
80
  val.to_i
72
81
  })
@@ -28,6 +28,7 @@ module Fluent
28
28
  config_param :remove_keys, :string, :default => nil
29
29
  config_param :keep_keys, :string, :default => nil
30
30
  config_param :renew_record, :bool, :default => false
31
+ config_param :renew_time_key, :string, :default => nil
31
32
  config_param :enable_ruby, :bool, :default => false
32
33
 
33
34
  def configure(conf)
@@ -81,6 +82,9 @@ module Fluent
81
82
  es.each do |time, record|
82
83
  last_record = record # for debug log
83
84
  new_record = reform(time, record, placeholders)
85
+ if @renew_time_key && new_record.has_key?(@renew_time_key)
86
+ time = new_record[@renew_time_key].to_i
87
+ end
84
88
  new_es.add(time, new_record)
85
89
  end
86
90
  new_es
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Fluent
18
18
 
19
- VERSION = '0.12.9'
19
+ VERSION = '0.12.10'
20
20
 
21
21
  end
@@ -16,6 +16,9 @@ module ConfigurableSpec
16
16
  config_param :name3, :string, :default => "base1"
17
17
  config_param :name4, :string, :default => "base1"
18
18
 
19
+ config_param :opt1, :enum, list: [:foo, :bar, :baz]
20
+ config_param :opt2, :enum, list: [:foo, :bar, :baz], default: :foo
21
+
19
22
  def get_all
20
23
  [@node, @flag1, @flag2, @name1, @name2, @name3, @name4]
21
24
  end
@@ -24,8 +27,10 @@ module ConfigurableSpec
24
27
  class Base2 < Base1
25
28
  config_set_default :name2, "base2"
26
29
  config_set_default :name4, "base2"
30
+ config_set_default :opt1, :bar
27
31
  config_param :name5, :string
28
32
  config_param :name6, :string, :default => "base2"
33
+ config_param :opt3, :enum, list: [:a, :b]
29
34
 
30
35
  def get_all
31
36
  ary = super
@@ -34,6 +39,7 @@ module ConfigurableSpec
34
39
  end
35
40
 
36
41
  class Base3 < Base2
42
+ config_set_default :opt3, :a
37
43
  config_section :node do
38
44
  config_param :name, :string, :default => "node"
39
45
  config_param :type, :string
@@ -56,6 +62,7 @@ module ConfigurableSpec
56
62
  end
57
63
 
58
64
  class Base4 < Base2
65
+ config_set_default :opt3, :a
59
66
  config_section :node, param_name: :nodes do
60
67
  config_argument :num, :integer
61
68
  config_param :name, :string, :default => "node"
@@ -154,6 +161,8 @@ module Fluent::Config
154
161
  assert_nil(obj1.name2)
155
162
  assert_equal("base1", obj1.name3)
156
163
  assert_equal("base1", obj1.name4)
164
+ assert_nil(obj1.opt1)
165
+ assert_equal(:foo, obj1.opt2)
157
166
  end
158
167
 
159
168
  test 'create instance methods and default values overwritten by sub class definition' do
@@ -167,13 +176,15 @@ module Fluent::Config
167
176
  assert_equal("base2", obj2.name4)
168
177
  assert_nil(obj2.name5)
169
178
  assert_equal("base2", obj2.name6)
179
+ assert_equal(:bar, obj2.opt1)
180
+ assert_equal(:foo, obj2.opt2)
170
181
  end
171
182
  end
172
183
 
173
184
  sub_test_case '#configure' do
174
185
  test 'returns configurable object itself' do
175
186
  b2 = ConfigurableSpec::Base2.new
176
- assert_instance_of(ConfigurableSpec::Base2, b2.configure({"name1" => "t1", "name5" => "t5"}))
187
+ assert_instance_of(ConfigurableSpec::Base2, b2.configure({"name1" => "t1", "name5" => "t5", "opt3" => "a"}))
177
188
  end
178
189
 
179
190
  test 'raise errors without any specifications for param without defaults' do
@@ -181,35 +192,49 @@ module Fluent::Config
181
192
  assert_raise(Fluent::ConfigError) { b2.configure({}) }
182
193
  assert_raise(Fluent::ConfigError) { b2.configure({"name1" => "t1"}) }
183
194
  assert_raise(Fluent::ConfigError) { b2.configure({"name5" => "t5"}) }
184
- assert_nothing_raised { b2.configure({"name1" => "t1", "name5" => "t5"}) }
195
+ assert_raise(Fluent::ConfigError) { b2.configure({"name1" => "t1", "name5" => "t5"}) }
196
+ assert_nothing_raised { b2.configure({"name1" => "t1", "name5" => "t5", "opt3" => "a"}) }
185
197
 
186
198
  assert_equal(["node", false, true, "t1", "base2", "base1", "base2", "t5", "base2"], b2.get_all)
199
+ assert_equal(:a, b2.opt3)
187
200
  end
188
201
 
189
202
  test 'can configure bool values' do
190
203
  b2a = ConfigurableSpec::Base2.new
191
- assert_nothing_raised { b2a.configure({"flag1" => "true", "flag2" => "yes", "name1" => "t1", "name5" => "t5"}) }
204
+ assert_nothing_raised { b2a.configure({"flag1" => "true", "flag2" => "yes", "name1" => "t1", "name5" => "t5", "opt3" => "a"}) }
192
205
  assert_true(b2a.flag1)
193
206
  assert_true(b2a.flag2)
194
207
 
195
208
  b2b = ConfigurableSpec::Base2.new
196
- assert_nothing_raised { b2b.configure({"flag1" => false, "flag2" => "no", "name1" => "t1", "name5" => "t5"}) }
209
+ assert_nothing_raised { b2b.configure({"flag1" => false, "flag2" => "no", "name1" => "t1", "name5" => "t5", "opt3" => "a"}) }
197
210
  assert_false(b2b.flag1)
198
211
  assert_false(b2b.flag2)
199
212
  end
200
213
 
201
214
  test 'overwrites values of defaults' do
202
215
  b2 = ConfigurableSpec::Base2.new
203
- b2.configure({"name1" => "t1", "name2" => "t2", "name3" => "t3", "name4" => "t4", "name5" => "t5"})
216
+ b2.configure({"name1" => "t1", "name2" => "t2", "name3" => "t3", "name4" => "t4", "name5" => "t5", "opt1" => "foo", "opt3" => "b"})
204
217
  assert_equal("t1", b2.name1)
205
218
  assert_equal("t2", b2.name2)
206
219
  assert_equal("t3", b2.name3)
207
220
  assert_equal("t4", b2.name4)
208
221
  assert_equal("t5", b2.name5)
209
222
  assert_equal("base2", b2.name6)
223
+ assert_equal(:foo, b2.opt1)
224
+ assert_equal(:b, b2.opt3)
210
225
 
211
226
  assert_equal(["node", false, true, "t1", "t2", "t3", "t4", "t5", "base2"], b2.get_all)
212
227
  end
228
+
229
+ test 'enum type rejects values which does not exist in list' do
230
+ default = {"name1" => "t1", "name2" => "t2", "name3" => "t3", "name4" => "t4", "name5" => "t5", "opt1" => "foo", "opt3" => "b"}
231
+
232
+ b2 = ConfigurableSpec::Base2.new
233
+ assert_nothing_raised { b2.configure(default) }
234
+ assert_raise(Fluent::ConfigError) { b2.configure(default.merge({"opt1" => "bazz"})) }
235
+ assert_raise(Fluent::ConfigError) { b2.configure(default.merge({"opt2" => "fooooooo"})) }
236
+ assert_raise(Fluent::ConfigError) { b2.configure(default.merge({"opt3" => "c"})) }
237
+ end
213
238
  end
214
239
  end
215
240
 
@@ -92,6 +92,16 @@ class RecordTransformerFilterTest < Test::Unit::TestCase
92
92
  end
93
93
  end
94
94
 
95
+ test 'renew_time_key' do
96
+ config = %[renew_time_key message]
97
+ times = [ Time.local(2,2,3,4,5,2010,nil,nil,nil,nil), Time.local(3,2,3,4,5,2010,nil,nil,nil,nil) ]
98
+ msgs = times.map{|t| t.to_i.to_s }
99
+ es = emit(config, msgs)
100
+ es.each_with_index do |(time, record), i|
101
+ assert_equal(times[i].to_i, time)
102
+ end
103
+ end
104
+
95
105
  test 'keep_keys' do
96
106
  config = %[renew_record true\nkeep_keys foo,message]
97
107
  msgs = ['1', '2']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluentd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.9
4
+ version: 0.12.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-19 00:00:00.000000000 Z
11
+ date: 2015-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack