fluentd 1.2.1 → 1.2.2
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.md +16 -0
- data/README.md +1 -1
- data/lib/fluent/config/configure_proxy.rb +7 -1
- data/lib/fluent/plugin/buffer.rb +7 -1
- data/lib/fluent/plugin/filter_parser.rb +3 -0
- data/lib/fluent/plugin/in_tail.rb +10 -12
- data/lib/fluent/supervisor.rb +1 -1
- data/lib/fluent/version.rb +1 -1
- data/test/command/test_plugin_config_formatter.rb +1 -1
- data/test/config/test_configure_proxy.rb +37 -0
- data/test/plugin/test_filter_parser.rb +10 -2
- data/test/plugin_helper/test_child_process.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db2e0fe87d5466ddca212327e3e0ad56bd7c6055daffd05bc351c5544153908d
|
4
|
+
data.tar.gz: b6b92ecd3814b496dfa7522850876bffeb6f2b59278159462b3de2e91a613170
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c359fac49d0273d40d2b8452eacc3c85d899264d44f9eb57e11bcdf73373b146f065dc0d2cee87b8542a4da3087a917d344809697e1e8065165066530eda26b5
|
7
|
+
data.tar.gz: a080e5d6948fe33bbc02ebfba49fb851c1facd9cf6a30a38a5f3762cb8e629e93950b3cf9d24780215655c12a7ca69a7cdaf546bed31bdab8319e8dcbdd9e405
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# v1.2
|
2
2
|
|
3
|
+
## Release v1.2.2 - 2018/06/12
|
4
|
+
|
5
|
+
### Enhancements
|
6
|
+
|
7
|
+
* filter_parser: Add remove_key_name_field parameter
|
8
|
+
https://github.com/fluent/fluentd/pull/2012
|
9
|
+
* fluent-plugin-config-format: Dump config_argument
|
10
|
+
https://github.com/fluent/fluentd/pull/2003
|
11
|
+
|
12
|
+
### Bug fixes
|
13
|
+
|
14
|
+
* in_tail: Change pos file entry handling to avoid read conflict for other plugins
|
15
|
+
https://github.com/fluent/fluentd/pull/1963
|
16
|
+
* buffer: Wait for all chunks being purged before deleting @queued_num items
|
17
|
+
https://github.com/fluent/fluentd/pull/2016
|
18
|
+
|
3
19
|
## Release v1.2.1 - 2018/05/23
|
4
20
|
|
5
21
|
### Enhancements
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ Fluentd: Open-Source Log Collector
|
|
5
5
|
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1189/badge)](https://bestpractices.coreinfrastructure.org/projects/1189)
|
6
6
|
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Ffluent%2Ffluentd.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Ffluent%2Ffluentd?ref=badge_shield)
|
7
7
|
|
8
|
-
[Fluentd](https://fluentd.org/) collects events from various data sources and writes them to files, RDBMS, NoSQL, IaaS, SaaS, Hadoop and so on. Fluentd helps you unify your logging infrastructure (Learn more about the [Unified Logging Layer](https://www.fluentd.org/blog/unified-logging-layer)).
|
8
|
+
[Fluentd](https://www.fluentd.org/) collects events from various data sources and writes them to files, RDBMS, NoSQL, IaaS, SaaS, Hadoop and so on. Fluentd helps you unify your logging infrastructure (Learn more about the [Unified Logging Layer](https://www.fluentd.org/blog/unified-logging-layer)).
|
9
9
|
|
10
10
|
<p align="center">
|
11
11
|
<img src="https://docs.fluentd.org/images/fluentd-architecture.png" width="500px"/>
|
@@ -370,6 +370,12 @@ module Fluent
|
|
370
370
|
|
371
371
|
def dump_config_definition
|
372
372
|
dumped_config = {}
|
373
|
+
if @argument
|
374
|
+
argument_name, _block, options = @argument
|
375
|
+
options[:required] = !@defaults.key?(argument_name)
|
376
|
+
options[:argument] = true
|
377
|
+
dumped_config[argument_name] = options
|
378
|
+
end
|
373
379
|
@params.each do |name, config|
|
374
380
|
dumped_config[name] = config[1]
|
375
381
|
dumped_config[name][:required] = !@defaults.key?(name)
|
@@ -378,7 +384,7 @@ module Fluent
|
|
378
384
|
end
|
379
385
|
# Overwrite by config_set_default
|
380
386
|
@defaults.each do |name, value|
|
381
|
-
if @params.key?(name)
|
387
|
+
if @params.key?(name) || @argument.first == name
|
382
388
|
dumped_config[name][:default] = value
|
383
389
|
else
|
384
390
|
dumped_config[name] = { default: value }
|
data/lib/fluent/plugin/buffer.rb
CHANGED
@@ -151,6 +151,7 @@ module Fluent
|
|
151
151
|
@queue = [] #=> Array (chunks) : already flushed (not written)
|
152
152
|
@dequeued = {} #=> Hash (unique_id -> chunk): already written (not purged)
|
153
153
|
@queued_num = {} # metadata => int (number of queued chunks)
|
154
|
+
@dequeued_num = {} # metadata => int (number of dequeued chunks)
|
154
155
|
|
155
156
|
@stage_size = @queue_size = 0
|
156
157
|
@metadata_list = [] # keys of @stage
|
@@ -462,6 +463,8 @@ module Fluent
|
|
462
463
|
|
463
464
|
@dequeued[chunk.unique_id] = chunk
|
464
465
|
@queued_num[chunk.metadata] -= 1 # BUG if nil, 0 or subzero
|
466
|
+
@dequeued_num[chunk.metadata] ||= 0
|
467
|
+
@dequeued_num[chunk.metadata] += 1
|
465
468
|
log.trace "chunk dequeued", instance: self.object_id, metadata: chunk.metadata
|
466
469
|
chunk
|
467
470
|
end
|
@@ -476,6 +479,7 @@ module Fluent
|
|
476
479
|
@queue.unshift(chunk)
|
477
480
|
log.trace "chunk taken back", instance: self.object_id, chunk_id: dump_unique_id_hex(chunk_id), metadata: chunk.metadata
|
478
481
|
@queued_num[chunk.metadata] += 1 # BUG if nil
|
482
|
+
@dequeued_num[chunk.metadata] -= 1
|
479
483
|
end
|
480
484
|
true
|
481
485
|
end
|
@@ -497,9 +501,11 @@ module Fluent
|
|
497
501
|
log.error_backtrace
|
498
502
|
end
|
499
503
|
|
500
|
-
|
504
|
+
@dequeued_num[chunk.metadata] -= 1
|
505
|
+
if metadata && !@stage[metadata] && (!@queued_num[metadata] || @queued_num[metadata] < 1) && @dequeued_num[metadata].zero?
|
501
506
|
@metadata_list.delete(metadata)
|
502
507
|
@queued_num.delete(metadata)
|
508
|
+
@dequeued_num.delete(metadata)
|
503
509
|
end
|
504
510
|
log.trace "chunk purged", instance: self.object_id, chunk_id: dump_unique_id_hex(chunk_id), metadata: metadata
|
505
511
|
end
|
@@ -32,6 +32,8 @@ module Fluent::Plugin
|
|
32
32
|
config_param :reserve_data, :bool, default: false
|
33
33
|
desc 'Keep original event time in parsed result.'
|
34
34
|
config_param :reserve_time, :bool, default: false
|
35
|
+
desc 'Remove "key_name" field from the record when parsing is succeeded'
|
36
|
+
config_param :remove_key_name_field, :bool, default: false
|
35
37
|
desc 'Store parsed values with specified key name prefix.'
|
36
38
|
config_param :inject_key_prefix, :string, default: nil
|
37
39
|
desc 'If true, invalid string is replaced with safe characters and re-parse it.'
|
@@ -75,6 +77,7 @@ module Fluent::Plugin
|
|
75
77
|
else
|
76
78
|
t.nil? ? time : t
|
77
79
|
end
|
80
|
+
@accessor.delete(record) if @remove_key_name_field
|
78
81
|
r = handle_parsed(tag, record, t, values)
|
79
82
|
return t, r
|
80
83
|
else
|
@@ -862,7 +862,7 @@ module Fluent::Plugin
|
|
862
862
|
@file.write "0000000000000000\t0000000000000000\n"
|
863
863
|
@last_pos = @file.pos
|
864
864
|
|
865
|
-
@map[path] = FilePositionEntry.new(@file, seek)
|
865
|
+
@map[path] = FilePositionEntry.new(@file, seek, 0, 0)
|
866
866
|
end
|
867
867
|
|
868
868
|
def self.parse(file)
|
@@ -874,8 +874,10 @@ module Fluent::Plugin
|
|
874
874
|
m = /^([^\t]+)\t([0-9a-fA-F]+)\t([0-9a-fA-F]+)/.match(line)
|
875
875
|
next unless m
|
876
876
|
path = m[1]
|
877
|
+
pos = m[2].to_i(16)
|
878
|
+
ino = m[3].to_i(16)
|
877
879
|
seek = file.pos - line.bytesize + path.bytesize + 1
|
878
|
-
map[path] = FilePositionEntry.new(file, seek)
|
880
|
+
map[path] = FilePositionEntry.new(file, seek, pos, ino)
|
879
881
|
}
|
880
882
|
new(file, map, file.pos)
|
881
883
|
end
|
@@ -908,16 +910,18 @@ module Fluent::Plugin
|
|
908
910
|
LN_OFFSET = 33
|
909
911
|
SIZE = 34
|
910
912
|
|
911
|
-
def initialize(file, seek)
|
913
|
+
def initialize(file, seek, pos, inode)
|
912
914
|
@file = file
|
913
915
|
@seek = seek
|
914
|
-
@pos =
|
916
|
+
@pos = pos
|
917
|
+
@inode = inode
|
915
918
|
end
|
916
919
|
|
917
920
|
def update(ino, pos)
|
918
921
|
@file.pos = @seek
|
919
922
|
@file.write "%016x\t%016x" % [pos, ino]
|
920
923
|
@pos = pos
|
924
|
+
@inode = ino
|
921
925
|
end
|
922
926
|
|
923
927
|
def update_pos(pos)
|
@@ -927,17 +931,11 @@ module Fluent::Plugin
|
|
927
931
|
end
|
928
932
|
|
929
933
|
def read_inode
|
930
|
-
@
|
931
|
-
raw = @file.read(16)
|
932
|
-
raw ? raw.to_i(16) : 0
|
934
|
+
@inode
|
933
935
|
end
|
934
936
|
|
935
937
|
def read_pos
|
936
|
-
@pos
|
937
|
-
@file.pos = @seek
|
938
|
-
raw = @file.read(16)
|
939
|
-
raw ? raw.to_i(16) : 0
|
940
|
-
end
|
938
|
+
@pos
|
941
939
|
end
|
942
940
|
end
|
943
941
|
|
data/lib/fluent/supervisor.rb
CHANGED
data/lib/fluent/version.rb
CHANGED
@@ -132,6 +132,7 @@ helpers: inject,compat_parameters
|
|
132
132
|
time_as_integer: bool: (false)
|
133
133
|
slow_flush_log_threshold: float: (20.0)
|
134
134
|
<buffer>: optional, single
|
135
|
+
chunk_keys: array: ([])
|
135
136
|
@type: string: ("memory")
|
136
137
|
timekey: time: (nil)
|
137
138
|
timekey_wait: time: (600)
|
@@ -154,7 +155,6 @@ slow_flush_log_threshold: float: (20.0)
|
|
154
155
|
retry_exponential_backoff_base: float: (2)
|
155
156
|
retry_max_interval: time: (nil)
|
156
157
|
retry_randomize: bool: (true)
|
157
|
-
chunk_keys: : ([])
|
158
158
|
<secondary>: optional, single
|
159
159
|
@type: string: (nil)
|
160
160
|
<buffer>: optional, single
|
@@ -435,6 +435,43 @@ module Fluent::Config
|
|
435
435
|
assert_equal(expected, @proxy.dump_config_definition)
|
436
436
|
end
|
437
437
|
|
438
|
+
test 'plain proxy w/ argument' do
|
439
|
+
@proxy.instance_eval do
|
440
|
+
config_argument(:argname, :string)
|
441
|
+
config_param(:name, :string, default: "name1")
|
442
|
+
end
|
443
|
+
expected = {
|
444
|
+
argname: { type: :string, required: true, argument: true },
|
445
|
+
name: { type: :string, default: "name1", required: false }
|
446
|
+
}
|
447
|
+
assert_equal(expected, @proxy.dump_config_definition)
|
448
|
+
end
|
449
|
+
|
450
|
+
test 'plain proxy w/ argument default value' do
|
451
|
+
@proxy.instance_eval do
|
452
|
+
config_argument(:argname, :string, default: "value")
|
453
|
+
config_param(:name, :string, default: "name1")
|
454
|
+
end
|
455
|
+
expected = {
|
456
|
+
argname: { type: :string, default: "value", required: false, argument: true },
|
457
|
+
name: { type: :string, default: "name1", required: false }
|
458
|
+
}
|
459
|
+
assert_equal(expected, @proxy.dump_config_definition)
|
460
|
+
end
|
461
|
+
|
462
|
+
test 'plain proxy w/ argument overwriting default value' do
|
463
|
+
@proxy.instance_eval do
|
464
|
+
config_argument(:argname, :string)
|
465
|
+
config_param(:name, :string, default: "name1")
|
466
|
+
config_set_default(:argname, "value1")
|
467
|
+
end
|
468
|
+
expected = {
|
469
|
+
argname: { type: :string, default: "value1", required: false, argument: true },
|
470
|
+
name: { type: :string, default: "name1", required: false }
|
471
|
+
}
|
472
|
+
assert_equal(expected, @proxy.dump_config_definition)
|
473
|
+
end
|
474
|
+
|
438
475
|
test 'single sub proxy' do
|
439
476
|
@proxy.config_section(:sub) do
|
440
477
|
config_param(:name, :string, default: "name1")
|
@@ -209,10 +209,13 @@ class ParserFilterTest < Test::Unit::TestCase
|
|
209
209
|
|
210
210
|
end
|
211
211
|
|
212
|
-
|
212
|
+
data(:keep_key_name => false,
|
213
|
+
:remove_key_name => true)
|
214
|
+
def test_filter_with_reserved_data(remove_key_name)
|
213
215
|
d1 = create_driver(%[
|
214
216
|
key_name data
|
215
217
|
reserve_data yes
|
218
|
+
remove_key_name_field #{remove_key_name}
|
216
219
|
<parse>
|
217
220
|
@type regexp
|
218
221
|
expression /^(?<x>\\d)(?<y>\\d) (?<t>.+)$/
|
@@ -230,6 +233,7 @@ class ParserFilterTest < Test::Unit::TestCase
|
|
230
233
|
d2 = create_driver(%[
|
231
234
|
key_name data
|
232
235
|
reserve_data yes
|
236
|
+
remove_key_name_field #{remove_key_name}
|
233
237
|
<parse>
|
234
238
|
@type json
|
235
239
|
</parse>
|
@@ -244,7 +248,11 @@ class ParserFilterTest < Test::Unit::TestCase
|
|
244
248
|
|
245
249
|
first = filtered[0]
|
246
250
|
assert_equal_event_time time, first[0]
|
247
|
-
|
251
|
+
if remove_key_name
|
252
|
+
assert_not_include first[1], 'data'
|
253
|
+
else
|
254
|
+
assert_equal '{"xxx":"first","yyy":"second"}', first[1]['data']
|
255
|
+
end
|
248
256
|
assert_equal 'first', first[1]['xxx']
|
249
257
|
assert_equal 'second', first[1]['yyy']
|
250
258
|
|
@@ -510,7 +510,7 @@ class ChildProcessTest < Test::Unit::TestCase
|
|
510
510
|
unless Fluent.windows?
|
511
511
|
test 'can specify subprocess name' do
|
512
512
|
io = IO.popen([["cat", "caaaaaaaaaaat"], '-'])
|
513
|
-
process_naming_enabled = (open("|ps"){|_io| _io.readlines }.select{|line| line.include?("caaaaaaaaaaat") }.size > 0)
|
513
|
+
process_naming_enabled = (open("|ps opid,cmd"){|_io| _io.readlines }.select{|line| line.include?("caaaaaaaaaaat") }.size > 0)
|
514
514
|
Process.kill(:TERM, io.pid) rescue nil
|
515
515
|
io.close rescue nil
|
516
516
|
|
@@ -527,15 +527,15 @@ class ChildProcessTest < Test::Unit::TestCase
|
|
527
527
|
m.lock
|
528
528
|
ran = true
|
529
529
|
pids << @d.child_process_id
|
530
|
-
proc_lines += open("|ps"){|_io| _io.readlines }
|
530
|
+
proc_lines += open("|ps opid,cmd"){|_io| _io.readlines }
|
531
531
|
m.unlock
|
532
532
|
readio.read
|
533
533
|
end
|
534
534
|
sleep TEST_WAIT_INTERVAL_FOR_BLOCK_RUNNING until m.locked? || ran
|
535
535
|
m.lock
|
536
536
|
pid = pids.first
|
537
|
-
#
|
538
|
-
assert{ proc_lines.select{|line| line =~ /^\s*#{pid}\s/ }.first.strip.split(/\s+/)[
|
537
|
+
# 16357 sleeeeeeeeeper -e sleep 10; puts "hello"
|
538
|
+
assert{ proc_lines.select{|line| line =~ /^\s*#{pid}\s/ }.first.strip.split(/\s+/)[1] == "sleeeeeeeeeper" }
|
539
539
|
@d.stop; @d.shutdown; @d.close; @d.terminate
|
540
540
|
end
|
541
541
|
end
|
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: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|