fluentd 0.12.39 → 0.12.40

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: 457250d0787e77f19de0da31390b5f6f597fad12
4
- data.tar.gz: c41f52a94f1c1a4728dd3721b32978850dd28a53
3
+ metadata.gz: 524485c147140fc4851fdaeab2ac208ae866363a
4
+ data.tar.gz: ba754459fd69e611c6930c0ac6307e47474d2503
5
5
  SHA512:
6
- metadata.gz: 147e84086641e3651908789e80ad9cac70c3cd0a4dc5d0a70128bdc9e670724b4ba80a01a58abdaa5a66aca4aadbe1eba95e2d267e21d62c79317585faddb5f9
7
- data.tar.gz: b51d04dea05b51b558c89d703ada04f1c431874b16dcfcfaaf0e8e84e7b0a51c3f8873d7d1580cd0cccc7a2f108a5fb44bdae45eb662e5227f7ff8fa31ee7076
6
+ metadata.gz: 722511c8f2827a6a68d4500ffe49ad761886738caed8a4823737b5d162b4cbefaeed4ecce216b144db07f9392df9b2bf4ef40cb1d24a7e750187a58ca6c57af8
7
+ data.tar.gz: 11eb85ece55f56692e2ecaea32eb881b9abf9d34c5b6d76358833eb5936a395e0dd080daaea9fa990c95e1b3f4bdf5bd5fbfd1aebb0ff2aac35a29bcd4f43449
data/ChangeLog CHANGED
@@ -1,5 +1,16 @@
1
1
  # v0.12
2
2
 
3
+ ## Release 0.12.40 - 2017/08/25
4
+
5
+ ### Bug fixes
6
+
7
+ * record_transformer: Don't create new keys if the original record doesn't have `keep_keys` keys
8
+ https://github.com/fluent/fluentd/pull/1663
9
+ * in_tail: Fix the error when 'tag *' is configured.
10
+ https://github.com/fluent/fluentd/pull/1664
11
+ * plugin: Fix load order to avoid file not found when plugins have own native extension
12
+ https://github.com/fluent/fluentd/pull/1670
13
+
3
14
  ## Release 0.12.39 - 2017/07/14
4
15
 
5
16
  ### Bug fixes
@@ -169,7 +169,10 @@ module Fluent
169
169
  if spec = specs.last
170
170
  spec.require_paths.each { |lib|
171
171
  file = "#{spec.full_gem_path}/#{lib}/#{path}"
172
- require file
172
+ if File.exist?("#{file}.rb")
173
+ require file
174
+ return
175
+ end
173
176
  }
174
177
  end
175
178
  end
@@ -28,9 +28,9 @@ module Fluent
28
28
  Fluent::Plugin.register_filter('record_transformer', self)
29
29
 
30
30
  desc 'A comma-delimited list of keys to delete.'
31
- config_param :remove_keys, :string, default: nil
31
+ config_param :remove_keys, :array, default: nil
32
32
  desc 'A comma-delimited list of keys to keep.'
33
- config_param :keep_keys, :string, default: nil
33
+ config_param :keep_keys, :array, default: nil
34
34
  desc 'Create new Hash to transform incoming data'
35
35
  config_param :renew_record, :bool, default: false
36
36
  desc 'Specify field name of the record to overwrite the time of events. Its value must be unix time.'
@@ -52,13 +52,8 @@ module Fluent
52
52
  end
53
53
  end
54
54
 
55
- if @remove_keys
56
- @remove_keys = @remove_keys.split(',')
57
- end
58
-
59
55
  if @keep_keys
60
56
  raise Fluent::ConfigError, "`renew_record` must be true to use `keep_keys`" unless @renew_record
61
- @keep_keys = @keep_keys.split(',')
62
57
  end
63
58
 
64
59
  placeholder_expander_params = {
@@ -128,7 +123,9 @@ module Fluent
128
123
  placeholders = @placeholder_expander.prepare_placeholders(placeholder_values)
129
124
 
130
125
  new_record = @renew_record ? {} : record.dup
131
- @keep_keys.each {|k| new_record[k] = record[k]} if @keep_keys and @renew_record
126
+ @keep_keys.each do |k|
127
+ new_record[k] = record[k] if record.has_key?(k)
128
+ end if @keep_keys && @renew_record
132
129
  new_record.merge!(expand_placeholders(@map, placeholders))
133
130
 
134
131
  new_record
@@ -220,7 +217,7 @@ module Fluent
220
217
  # @param [String] str
221
218
  # @param [Boolean] force_stringify the value must be string, used for hash key
222
219
  def expand(str, placeholders, force_stringify = false)
223
- if @auto_typecast and !force_stringify
220
+ if @auto_typecast && !force_stringify
224
221
  single_placeholder_matched = str.match(/\A(\${[^}]+}|__[A-Z_]+__)\z/)
225
222
  if single_placeholder_matched
226
223
  log_if_unknown_placeholder($1, placeholders)
@@ -263,9 +260,9 @@ module Fluent
263
260
  def preprocess_map(value, force_stringify = false)
264
261
  new_value = nil
265
262
  if value.is_a?(String)
266
- if @auto_typecast and !force_stringify
263
+ if @auto_typecast && !force_stringify
267
264
  num_placeholders = value.scan('${').size
268
- if num_placeholders == 1 and value.start_with?('${') && value.end_with?('}')
265
+ if num_placeholders == 1 && value.start_with?('${') && value.end_with?('}')
269
266
  new_value = value[2..-2] # ${..} => ..
270
267
  end
271
268
  end
@@ -101,6 +101,7 @@ module Fluent
101
101
  def configure_tag
102
102
  if @tag.index('*')
103
103
  @tag_prefix, @tag_suffix = @tag.split('*')
104
+ @tag_prefix ||= ''
104
105
  @tag_suffix ||= ''
105
106
  else
106
107
  @tag_prefix = nil
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Fluent
18
18
 
19
- VERSION = '0.12.39'
19
+ VERSION = '0.12.40'
20
20
 
21
21
  end
@@ -131,6 +131,18 @@ class RecordTransformerFilterTest < Test::Unit::TestCase
131
131
  end
132
132
  end
133
133
 
134
+ test 'keep_keys that are not present in the original record should not be included in the result record' do
135
+ config = %[renew_record true\nkeep_keys foo, bar, baz, message]
136
+ msgs = ['1', '2', nil]
137
+ es = emit(config, msgs)
138
+ es.each_with_index do |(t, r), i|
139
+ assert_equal('bar', r['foo'])
140
+ assert_equal(msgs[i], r['message'])
141
+ assert_equal(false, r.has_key?('bar'))
142
+ assert_equal(false, r.has_key?('baz'))
143
+ end
144
+ end
145
+
134
146
  test 'enable_ruby' do
135
147
  config = %[
136
148
  enable_ruby yes
@@ -820,6 +820,18 @@ class TailInputTest < Test::Unit::TestCase
820
820
  engineclass.should_receive(:emit_stream).with('pre.foo.bar.log.post', any).once
821
821
  plugin.receive_lines(['foo', 'bar'], DummyWatcher.new('foo.bar.log'))
822
822
  end
823
+
824
+ config = %[
825
+ tag *
826
+ path test/plugin/*/%Y/%m/%Y%m%d-%H%M%S.log,test/plugin/data/log/**/*.log
827
+ format none
828
+ read_from_head true
829
+ ]
830
+ plugin = create_driver(config, false).instance
831
+ flexstub(plugin.router) do |engineclass|
832
+ engineclass.should_receive(:emit_stream).with('foo.bar.log', any).once
833
+ plugin.receive_lines(['foo', 'bar'], DummyWatcher.new('foo.bar.log'))
834
+ end
823
835
  end
824
836
 
825
837
  # Ensure that no fatal exception is raised when a file is missing and that
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.39
4
+ version: 0.12.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-14 00:00:00.000000000 Z
11
+ date: 2017-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack