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 +4 -4
- data/ChangeLog +11 -0
- data/lib/fluent/plugin.rb +4 -1
- data/lib/fluent/plugin/filter_record_transformer.rb +8 -11
- data/lib/fluent/plugin/in_tail.rb +1 -0
- data/lib/fluent/version.rb +1 -1
- data/test/plugin/test_filter_record_transformer.rb +12 -0
- data/test/plugin/test_in_tail.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 524485c147140fc4851fdaeab2ac208ae866363a
|
4
|
+
data.tar.gz: ba754459fd69e611c6930c0ac6307e47474d2503
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/fluent/plugin.rb
CHANGED
@@ -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, :
|
31
|
+
config_param :remove_keys, :array, default: nil
|
32
32
|
desc 'A comma-delimited list of keys to keep.'
|
33
|
-
config_param :keep_keys, :
|
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
|
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
|
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
|
263
|
+
if @auto_typecast && !force_stringify
|
267
264
|
num_placeholders = value.scan('${').size
|
268
|
-
if num_placeholders == 1
|
265
|
+
if num_placeholders == 1 && value.start_with?('${') && value.end_with?('}')
|
269
266
|
new_value = value[2..-2] # ${..} => ..
|
270
267
|
end
|
271
268
|
end
|
data/lib/fluent/version.rb
CHANGED
@@ -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
|
data/test/plugin/test_in_tail.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2017-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|