fluentd 1.14.4-x86-mingw32 → 1.15.0-x86-mingw32
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/.github/ISSUE_TEMPLATE/config.yml +2 -2
- data/.github/workflows/linux-test.yaml +1 -1
- data/.github/workflows/macos-test.yaml +5 -1
- data/.github/workflows/windows-test.yaml +9 -6
- data/CHANGELOG.md +115 -19
- data/CONTRIBUTING.md +1 -1
- data/MAINTAINERS.md +2 -2
- data/README.md +2 -23
- data/Rakefile +1 -1
- data/fluentd.gemspec +3 -1
- data/lib/fluent/command/ctl.rb +4 -1
- data/lib/fluent/command/fluentd.rb +14 -0
- data/lib/fluent/config/error.rb +12 -0
- data/lib/fluent/config/literal_parser.rb +2 -2
- data/lib/fluent/config/yaml_parser/fluent_value.rb +47 -0
- data/lib/fluent/config/yaml_parser/loader.rb +91 -0
- data/lib/fluent/config/yaml_parser/parser.rb +166 -0
- data/lib/fluent/config/yaml_parser/section_builder.rb +107 -0
- data/lib/fluent/config/yaml_parser.rb +56 -0
- data/lib/fluent/config.rb +14 -1
- data/lib/fluent/event_router.rb +19 -1
- data/lib/fluent/plugin/bare_output.rb +1 -1
- data/lib/fluent/plugin/base.rb +1 -1
- data/lib/fluent/plugin/file_wrapper.rb +52 -107
- data/lib/fluent/plugin/in_forward.rb +1 -1
- data/lib/fluent/plugin/in_http.rb +11 -1
- data/lib/fluent/plugin/in_tail/group_watch.rb +204 -0
- data/lib/fluent/plugin/in_tail/position_file.rb +1 -15
- data/lib/fluent/plugin/in_tail.rb +66 -47
- data/lib/fluent/plugin/out_forward/socket_cache.rb +2 -0
- data/lib/fluent/plugin/output.rb +43 -33
- data/lib/fluent/plugin/parser.rb +3 -4
- data/lib/fluent/plugin/parser_syslog.rb +1 -1
- data/lib/fluent/plugin_helper/retry_state.rb +14 -4
- data/lib/fluent/plugin_helper/server.rb +23 -4
- data/lib/fluent/plugin_helper/service_discovery.rb +2 -2
- data/lib/fluent/plugin_helper/socket.rb +13 -2
- data/lib/fluent/registry.rb +2 -1
- data/lib/fluent/rpc.rb +4 -3
- data/lib/fluent/supervisor.rb +114 -27
- data/lib/fluent/system_config.rb +2 -1
- data/lib/fluent/version.rb +1 -1
- data/lib/fluent/winsvc.rb +2 -0
- data/test/command/test_ctl.rb +0 -1
- data/test/command/test_fluentd.rb +33 -0
- data/test/compat/test_parser.rb +1 -1
- data/test/config/test_system_config.rb +3 -1
- data/test/config/test_types.rb +1 -1
- data/test/plugin/in_tail/test_io_handler.rb +14 -4
- data/test/plugin/in_tail/test_position_file.rb +0 -63
- data/test/plugin/out_forward/test_socket_cache.rb +26 -1
- data/test/plugin/test_file_wrapper.rb +0 -68
- data/test/plugin/test_filter_parser.rb +1 -1
- data/test/plugin/test_filter_stdout.rb +2 -2
- data/test/plugin/test_in_forward.rb +0 -2
- data/test/plugin/test_in_http.rb +23 -0
- data/test/plugin/test_in_object_space.rb +9 -3
- data/test/plugin/test_in_syslog.rb +1 -1
- data/test/plugin/test_in_tail.rb +629 -353
- data/test/plugin/test_out_forward.rb +30 -20
- data/test/plugin/test_out_stdout.rb +2 -2
- data/test/plugin/test_output_as_buffered_retries.rb +53 -6
- data/test/plugin/test_output_as_buffered_secondary.rb +1 -1
- data/test/plugin/test_parser_syslog.rb +1 -1
- data/test/plugin_helper/test_cert_option.rb +1 -1
- data/test/plugin_helper/test_child_process.rb +16 -4
- data/test/plugin_helper/test_retry_state.rb +602 -38
- data/test/plugin_helper/test_server.rb +18 -0
- data/test/test_config.rb +135 -4
- data/test/test_event_router.rb +17 -0
- data/test/test_formatter.rb +1 -1
- data/test/test_supervisor.rb +196 -6
- metadata +39 -5
@@ -431,10 +431,12 @@ EOL
|
|
431
431
|
]
|
432
432
|
|
433
433
|
stub(d.instance.ack_handler).read_ack_from_sock(anything).never
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
434
|
+
assert_rr do
|
435
|
+
target_input_driver.run(expect_records: 2) do
|
436
|
+
d.run do
|
437
|
+
emit_events.each do |tag, t, record|
|
438
|
+
d.feed(tag, t, record)
|
439
|
+
end
|
438
440
|
end
|
439
441
|
end
|
440
442
|
end
|
@@ -461,10 +463,12 @@ EOL
|
|
461
463
|
]
|
462
464
|
|
463
465
|
stub(d.instance.ack_handler).read_ack_from_sock(anything).never
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
466
|
+
assert_rr do
|
467
|
+
target_input_driver.run(expect_records: 2) do
|
468
|
+
d.run(default_tag: 'test') do
|
469
|
+
records.each do |record|
|
470
|
+
d.feed(time, record)
|
471
|
+
end
|
468
472
|
end
|
469
473
|
end
|
470
474
|
end
|
@@ -491,10 +495,12 @@ EOL
|
|
491
495
|
{"a" => 2}
|
492
496
|
]
|
493
497
|
stub(d.instance.ack_handler).read_ack_from_sock(anything).never
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
+
assert_rr do
|
499
|
+
target_input_driver.run(expect_records: 2) do
|
500
|
+
d.run(default_tag: 'test') do
|
501
|
+
records.each do |record|
|
502
|
+
d.feed(time, record)
|
503
|
+
end
|
498
504
|
end
|
499
505
|
end
|
500
506
|
end
|
@@ -549,10 +555,12 @@ EOL
|
|
549
555
|
]
|
550
556
|
# not attempt to receive responses
|
551
557
|
stub(d.instance.ack_handler).read_ack_from_sock(anything).never
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
558
|
+
assert_rr do
|
559
|
+
target_input_driver.run(expect_records: 2) do
|
560
|
+
d.run(default_tag: 'test') do
|
561
|
+
records.each do |record|
|
562
|
+
d.feed(time, record)
|
563
|
+
end
|
556
564
|
end
|
557
565
|
end
|
558
566
|
end
|
@@ -575,10 +583,12 @@ EOL
|
|
575
583
|
]
|
576
584
|
# not attempt to receive responses
|
577
585
|
stub(d.instance.ack_handler).read_ack_from_sock(anything).never
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
586
|
+
assert_rr do
|
587
|
+
target_input_driver.run(expect_records: 2) do
|
588
|
+
d.run(default_tag: 'test') do
|
589
|
+
records.each do |record|
|
590
|
+
d.feed(time, record)
|
591
|
+
end
|
582
592
|
end
|
583
593
|
end
|
584
594
|
end
|
@@ -32,7 +32,7 @@ class StdoutOutputTest < Test::Unit::TestCase
|
|
32
32
|
assert_kind_of Fluent::Plugin::StdoutFormatter, d.instance.formatter
|
33
33
|
assert_equal 'hash', d.instance.formatter.output_type
|
34
34
|
|
35
|
-
assert_raise(Fluent::
|
35
|
+
assert_raise(Fluent::NotFoundPluginError) do
|
36
36
|
d = create_driver(CONFIG + "\noutput_type foo")
|
37
37
|
end
|
38
38
|
end
|
@@ -126,7 +126,7 @@ class StdoutOutputTest < Test::Unit::TestCase
|
|
126
126
|
assert_kind_of Fluent::Plugin::StdoutFormatter, d.instance.formatter
|
127
127
|
assert_equal 'hash', d.instance.formatter.output_type
|
128
128
|
|
129
|
-
assert_raise(Fluent::
|
129
|
+
assert_raise(Fluent::NotFoundPluginError) do
|
130
130
|
create_driver(config_element("ROOT", "", {"output_type" => "foo"}, [config_element("buffer")]))
|
131
131
|
end
|
132
132
|
end
|
@@ -140,13 +140,13 @@ class BufferedOutputRetryTest < Test::Unit::TestCase
|
|
140
140
|
|
141
141
|
retry_state = @i.retry_state( @i.buffer_config.retry_randomize )
|
142
142
|
retry_state.step
|
143
|
-
assert_equal 1, (retry_state.next_time - now)
|
144
|
-
retry_state.step
|
145
143
|
assert_equal (1 * (2 ** 1)), (retry_state.next_time - now)
|
146
144
|
retry_state.step
|
147
145
|
assert_equal (1 * (2 ** 2)), (retry_state.next_time - now)
|
148
146
|
retry_state.step
|
149
147
|
assert_equal (1 * (2 ** 3)), (retry_state.next_time - now)
|
148
|
+
retry_state.step
|
149
|
+
assert_equal (1 * (2 ** 4)), (retry_state.next_time - now)
|
150
150
|
end
|
151
151
|
|
152
152
|
test 'does retries correctly when #write fails' do
|
@@ -332,7 +332,7 @@ class BufferedOutputRetryTest < Test::Unit::TestCase
|
|
332
332
|
@i.emit_events("test.tag.3", dummy_event_stream())
|
333
333
|
|
334
334
|
logs = @i.log.out.logs
|
335
|
-
assert{ logs.any?{|l| l.include?("[error]:
|
335
|
+
assert{ logs.any?{|l| l.include?("[error]: Hit limit for retries. dropping all chunks in the buffer queue.") } }
|
336
336
|
end
|
337
337
|
|
338
338
|
test 'output plugin give retries up by retry_max_times, and clear queue in buffer' do
|
@@ -409,7 +409,7 @@ class BufferedOutputRetryTest < Test::Unit::TestCase
|
|
409
409
|
@i.emit_events("test.tag.3", dummy_event_stream())
|
410
410
|
|
411
411
|
logs = @i.log.out.logs
|
412
|
-
assert{ logs.any?{|l| l.include?("[error]:
|
412
|
+
assert{ logs.any?{|l| l.include?("[error]: Hit limit for retries. dropping all chunks in the buffer queue.") && l.include?("retry_times=10") } }
|
413
413
|
|
414
414
|
assert{ @i.buffer.queue.size == 0 }
|
415
415
|
assert{ @i.buffer.stage.size == 1 }
|
@@ -607,7 +607,7 @@ class BufferedOutputRetryTest < Test::Unit::TestCase
|
|
607
607
|
logs = @i.log.out.logs
|
608
608
|
|
609
609
|
target_time = Time.parse("2016-04-13 18:35:31 -0700")
|
610
|
-
target_msg = "[error]:
|
610
|
+
target_msg = "[error]: Hit limit for retries. dropping all chunks in the buffer queue."
|
611
611
|
assert{ logs.any?{|l| l.include?(target_msg) } }
|
612
612
|
|
613
613
|
log_time = get_log_time(target_msg, logs)
|
@@ -695,12 +695,59 @@ class BufferedOutputRetryTest < Test::Unit::TestCase
|
|
695
695
|
@i.emit_events("test.tag.3", dummy_event_stream())
|
696
696
|
|
697
697
|
logs = @i.log.out.logs
|
698
|
-
assert{ logs.any?{|l| l.include?("[error]:
|
698
|
+
assert{ logs.any?{|l| l.include?("[error]: Hit limit for retries. dropping all chunks in the buffer queue.") && l.include?("retry_times=10") } }
|
699
699
|
|
700
700
|
assert{ @i.buffer.queue.size == 0 }
|
701
701
|
assert{ @i.buffer.stage.size == 1 }
|
702
702
|
assert{ chunks.all?{|c| c.empty? } }
|
703
703
|
end
|
704
|
+
|
705
|
+
test 'Do not retry when retry_max_times is 0' do
|
706
|
+
written_tags = []
|
707
|
+
|
708
|
+
chunk_key = 'tag'
|
709
|
+
hash = {
|
710
|
+
'flush_interval' => 1,
|
711
|
+
'flush_thread_burst_interval' => 0.1,
|
712
|
+
'retry_type' => :periodic,
|
713
|
+
'retry_wait' => 1,
|
714
|
+
'retry_randomize' => false,
|
715
|
+
'retry_max_times' => 0,
|
716
|
+
'queued_chunks_limit_size' => 100
|
717
|
+
}
|
718
|
+
@i.configure(config_element('ROOT','',{},[config_element('buffer',chunk_key,hash)]))
|
719
|
+
@i.register(:prefer_buffered_processing){ true }
|
720
|
+
@i.register(:format){|tag,time,record| [tag,time.to_i,record].to_json + "\n" }
|
721
|
+
@i.register(:write){|chunk| written_tags << chunk.metadata.tag; raise "yay, your #write must fail" }
|
722
|
+
@i.start
|
723
|
+
@i.after_start
|
724
|
+
|
725
|
+
@i.interrupt_flushes
|
726
|
+
|
727
|
+
now = Time.parse('2016-04-13 18:33:30 -0700')
|
728
|
+
Timecop.freeze( now )
|
729
|
+
|
730
|
+
@i.emit_events("test.tag.1", dummy_event_stream())
|
731
|
+
|
732
|
+
now = Time.parse('2016-04-13 18:33:31 -0700')
|
733
|
+
Timecop.freeze( now )
|
734
|
+
|
735
|
+
@i.emit_events("test.tag.2", dummy_event_stream())
|
736
|
+
|
737
|
+
assert_equal(0, @i.write_count)
|
738
|
+
assert_equal(0, @i.num_errors)
|
739
|
+
|
740
|
+
@i.enqueue_thread_wait
|
741
|
+
@i.flush_thread_wakeup
|
742
|
+
waiting(2){ Thread.pass until @i.write_count == 1 && @i.num_errors == 1 }
|
743
|
+
|
744
|
+
assert(@i.write_count == 1)
|
745
|
+
assert(@i.num_errors == 1)
|
746
|
+
assert(@i.log.out.logs.any?{|l| l.include?("[error]: Hit limit for retries. dropping all chunks in the buffer queue.") && l.include?("retry_times=0") })
|
747
|
+
assert(@i.buffer.queue.size == 0)
|
748
|
+
assert(@i.buffer.stage.size == 1)
|
749
|
+
assert(@i.buffer.queue.all?{|c| c.empty? })
|
750
|
+
end
|
704
751
|
end
|
705
752
|
|
706
753
|
sub_test_case 'buffered output configured as retry_forever' do
|
@@ -874,7 +874,7 @@ class BufferedOutputSecondaryTest < Test::Unit::TestCase
|
|
874
874
|
end
|
875
875
|
|
876
876
|
logs = @i.log.out.logs
|
877
|
-
assert{ logs.any?{|l| l.include?("[error]:
|
877
|
+
assert{ logs.any?{|l| l.include?("[error]: Hit limit for retries. dropping all chunks in the buffer queue.") } }
|
878
878
|
|
879
879
|
assert{ now >= first_failure + 60 }
|
880
880
|
end
|
@@ -644,7 +644,7 @@ class SyslogParserTest < ::Test::Unit::TestCase
|
|
644
644
|
|
645
645
|
data('regexp' => :regexp, 'string' => :string)
|
646
646
|
def test_parser_engine(engine)
|
647
|
-
|
647
|
+
@parser.configure({'parser_engine' => engine.to_s})
|
648
648
|
assert_equal(engine, @parser.instance.parser_engine)
|
649
649
|
end
|
650
650
|
end
|
@@ -19,7 +19,7 @@ class CertOptionPluginHelperTest < Test::Unit::TestCase
|
|
19
19
|
test 'raise an error for broken certificates_from_file file' do
|
20
20
|
d = Dummy.new
|
21
21
|
assert_raise Fluent::ConfigError do
|
22
|
-
|
22
|
+
d.cert_option_certificates_from_file("test/plugin_helper/data/cert/empty.pem")
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -321,15 +321,21 @@ class ChildProcessTest < Test::Unit::TestCase
|
|
321
321
|
ary = []
|
322
322
|
arguments = ["okay"]
|
323
323
|
Timeout.timeout(TEST_DEADLOCK_TIMEOUT) do
|
324
|
+
start_time = Fluent::Clock.now
|
324
325
|
@d.child_process_execute(:t5, "echo", arguments: arguments, interval: 1, mode: [:read]) do |io|
|
325
326
|
ary << io.read.split("\n").map(&:chomp).join
|
326
327
|
end
|
327
|
-
|
328
|
+
1.upto(2) do |i|
|
329
|
+
sleep 0.1 while ary.size < i
|
330
|
+
elapsed = Fluent::Clock.now - start_time
|
331
|
+
assert_equal(i, ary.size)
|
332
|
+
assert_true(elapsed > i && elapsed < i + 0.5,
|
333
|
+
"actual elapsed: #{elapsed}")
|
334
|
+
end
|
328
335
|
assert_equal [], @d.log.out.logs
|
329
336
|
@d.stop
|
330
337
|
assert_equal [], @d.log.out.logs
|
331
338
|
@d.shutdown; @d.close; @d.terminate
|
332
|
-
assert_equal 2, ary.size
|
333
339
|
end
|
334
340
|
end
|
335
341
|
|
@@ -337,12 +343,18 @@ class ChildProcessTest < Test::Unit::TestCase
|
|
337
343
|
ary = []
|
338
344
|
arguments = ["okay"]
|
339
345
|
Timeout.timeout(TEST_DEADLOCK_TIMEOUT) do
|
346
|
+
start_time = Fluent::Clock.now
|
340
347
|
@d.child_process_execute(:t6, "echo", arguments: arguments, interval: 1, immediate: true, mode: [:read]) do |io|
|
341
348
|
ary << io.read.split("\n").map(&:chomp).join
|
342
349
|
end
|
343
|
-
|
350
|
+
0.upto(1) do |i|
|
351
|
+
sleep 0.1 while ary.size < i + 1
|
352
|
+
elapsed = Fluent::Clock.now - start_time
|
353
|
+
assert_equal(i + 1, ary.size)
|
354
|
+
assert_true(elapsed > i && elapsed < i + 0.5,
|
355
|
+
"actual elapsed: #{elapsed}")
|
356
|
+
end
|
344
357
|
@d.stop; @d.shutdown; @d.close; @d.terminate
|
345
|
-
assert_equal 2, ary.size
|
346
358
|
assert_equal [], @d.log.out.logs
|
347
359
|
end
|
348
360
|
end
|