fluentd 1.14.3-x86-mingw32 → 1.14.6-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 +6 -6
- data/CHANGELOG.md +79 -16
- data/CONTRIBUTING.md +1 -1
- data/MAINTAINERS.md +2 -2
- data/README.md +2 -23
- data/Rakefile +1 -1
- data/fluentd.gemspec +2 -1
- data/lib/fluent/command/fluentd.rb +4 -0
- data/lib/fluent/config/error.rb +12 -0
- data/lib/fluent/env.rb +4 -0
- 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/buffer.rb +43 -23
- data/lib/fluent/plugin/in_forward.rb +1 -1
- data/lib/fluent/plugin/in_http.rb +11 -1
- data/lib/fluent/plugin/in_tail.rb +10 -0
- data/lib/fluent/plugin/out_file.rb +13 -1
- data/lib/fluent/plugin/output.rb +41 -32
- data/lib/fluent/plugin/parser.rb +3 -4
- data/lib/fluent/plugin_helper/retry_state.rb +14 -4
- data/lib/fluent/plugin_helper/server.rb +21 -4
- 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 +5 -2
- data/lib/fluent/version.rb +1 -1
- data/test/compat/test_parser.rb +1 -1
- data/test/plugin/test_bare_output.rb +1 -1
- data/test/plugin/test_buffer.rb +77 -0
- data/test/plugin/test_filter.rb +1 -1
- 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_tail.rb +35 -0
- data/test/plugin/test_input.rb +1 -1
- data/test/plugin/test_out_exec.rb +6 -4
- data/test/plugin/test_out_file.rb +29 -13
- 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 +2 -2
- data/test/plugin_helper/test_retry_state.rb +602 -38
- data/test/plugin_helper/test_server.rb +18 -0
- data/test/plugin_helper/test_timer.rb +2 -2
- data/test/test_event_router.rb +17 -0
- data/test/test_formatter.rb +1 -1
- data/test/test_supervisor.rb +41 -6
- metadata +19 -5
@@ -394,6 +394,11 @@ class FileOutputTest < Test::Unit::TestCase
|
|
394
394
|
assert_equal expect, result
|
395
395
|
end
|
396
396
|
|
397
|
+
def check_result(path, expect)
|
398
|
+
result = File.read(path, mode: "rb")
|
399
|
+
assert_equal expect, result
|
400
|
+
end
|
401
|
+
|
397
402
|
sub_test_case 'write' do
|
398
403
|
test 'basic case' do
|
399
404
|
d = create_driver
|
@@ -535,20 +540,27 @@ class FileOutputTest < Test::Unit::TestCase
|
|
535
540
|
assert_equal 3, Dir.glob("#{TMP_DIR}/out_file_test.*").size
|
536
541
|
end
|
537
542
|
|
538
|
-
|
543
|
+
data(
|
544
|
+
"with compression" => true,
|
545
|
+
"without compression" => false,
|
546
|
+
)
|
547
|
+
test 'append' do |compression|
|
539
548
|
time = event_time("2011-01-02 13:14:15 UTC")
|
540
549
|
formatted_lines = %[2011-01-02T13:14:15Z\ttest\t{"a":1}#{@default_newline}] + %[2011-01-02T13:14:15Z\ttest\t{"a":2}#{@default_newline}]
|
541
550
|
|
542
551
|
write_once = ->(){
|
543
|
-
|
552
|
+
config = %[
|
544
553
|
path #{TMP_DIR}/out_file_test
|
545
|
-
compress gz
|
546
554
|
utc
|
547
555
|
append true
|
548
556
|
<buffer>
|
549
557
|
timekey_use_utc true
|
550
558
|
</buffer>
|
551
559
|
]
|
560
|
+
if compression
|
561
|
+
config << " compress gz"
|
562
|
+
end
|
563
|
+
d = create_driver(config)
|
552
564
|
d.run(default_tag: 'test'){
|
553
565
|
d.feed(time, {"a"=>1})
|
554
566
|
d.feed(time, {"a"=>2})
|
@@ -556,17 +568,21 @@ class FileOutputTest < Test::Unit::TestCase
|
|
556
568
|
d.instance.last_written_path
|
557
569
|
}
|
558
570
|
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
path = write_once.call
|
564
|
-
assert_equal "#{TMP_DIR}/out_file_test.20110102.log.gz", path
|
565
|
-
check_gzipped_result(path, formatted_lines * 2)
|
571
|
+
log_file_name = "out_file_test.20110102.log"
|
572
|
+
if compression
|
573
|
+
log_file_name << ".gz"
|
574
|
+
end
|
566
575
|
|
567
|
-
|
568
|
-
|
569
|
-
|
576
|
+
1.upto(3) do |i|
|
577
|
+
path = write_once.call
|
578
|
+
assert_equal "#{TMP_DIR}/#{log_file_name}", path
|
579
|
+
expect = formatted_lines * i
|
580
|
+
if compression
|
581
|
+
check_gzipped_result(path, expect)
|
582
|
+
else
|
583
|
+
check_result(path, expect)
|
584
|
+
end
|
585
|
+
end
|
570
586
|
end
|
571
587
|
|
572
588
|
test 'append when JST' do
|
@@ -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
|
@@ -775,7 +775,7 @@ class BufferedOutputSecondaryTest < Test::Unit::TestCase
|
|
775
775
|
assert_equal [ 'test.tag.1', event_time('2016-04-13 18:33:13').to_i, {"name" => "moris", "age" => 36, "message" => "data2"} ], written[1]
|
776
776
|
assert_equal [ 'test.tag.1', event_time('2016-04-13 18:33:32').to_i, {"name" => "moris", "age" => 36, "message" => "data3"} ], written[2]
|
777
777
|
|
778
|
-
assert
|
778
|
+
assert(@i.log.out.logs.any?{|l| l.include?("[warn]: retry succeeded by secondary.") })
|
779
779
|
end
|
780
780
|
|
781
781
|
test 'exponential backoff interval will be initialized when switched to secondary' 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
|