fluentd 1.16.1-x64-mingw-ucrt → 1.16.2-x64-mingw-ucrt
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +37 -0
- data/fluentd.gemspec +1 -1
- data/lib/fluent/command/ctl.rb +2 -2
- data/lib/fluent/command/plugin_config_formatter.rb +1 -1
- data/lib/fluent/config/dsl.rb +1 -1
- data/lib/fluent/config/v1_parser.rb +2 -2
- data/lib/fluent/counter/server.rb +1 -1
- data/lib/fluent/counter/validator.rb +3 -3
- data/lib/fluent/engine.rb +1 -1
- data/lib/fluent/event.rb +6 -2
- data/lib/fluent/log.rb +9 -0
- data/lib/fluent/match.rb +1 -1
- data/lib/fluent/msgpack_factory.rb +6 -1
- data/lib/fluent/plugin/base.rb +1 -1
- data/lib/fluent/plugin/filter_record_transformer.rb +1 -1
- data/lib/fluent/plugin/in_forward.rb +1 -1
- data/lib/fluent/plugin/in_http.rb +8 -8
- data/lib/fluent/plugin/in_sample.rb +1 -1
- data/lib/fluent/plugin/in_tail/position_file.rb +32 -18
- data/lib/fluent/plugin/in_tail.rb +58 -24
- data/lib/fluent/plugin/out_exec_filter.rb +2 -2
- data/lib/fluent/plugin/output.rb +1 -1
- data/lib/fluent/plugin/parser_json.rb +1 -1
- data/lib/fluent/plugin_helper/event_loop.rb +2 -2
- data/lib/fluent/plugin_helper/record_accessor.rb +1 -1
- data/lib/fluent/plugin_helper/thread.rb +3 -3
- data/lib/fluent/plugin_id.rb +1 -1
- data/lib/fluent/supervisor.rb +1 -1
- data/lib/fluent/version.rb +1 -1
- data/test/plugin/in_tail/test_position_file.rb +31 -1
- data/test/plugin/test_base.rb +1 -1
- data/test/plugin/test_buffer_chunk.rb +11 -0
- data/test/plugin/test_in_forward.rb +9 -9
- data/test/plugin/test_in_tail.rb +379 -0
- data/test/plugin/test_in_unix.rb +2 -2
- data/test/plugin/test_multi_output.rb +1 -1
- data/test/plugin/test_out_exec_filter.rb +2 -2
- data/test/plugin/test_out_file.rb +2 -2
- data/test/plugin/test_output.rb +12 -12
- data/test/plugin/test_output_as_buffered.rb +44 -44
- data/test/plugin/test_output_as_buffered_retries.rb +1 -1
- data/test/plugin/test_output_as_buffered_secondary.rb +2 -2
- data/test/plugin_helper/test_child_process.rb +2 -2
- data/test/plugin_helper/test_server.rb +1 -1
- data/test/test_log.rb +38 -1
- data/test/test_msgpack_factory.rb +32 -0
- data/test/test_supervisor.rb +13 -0
- metadata +4 -4
data/test/plugin/test_output.rb
CHANGED
@@ -447,25 +447,25 @@ class OutputTest < Test::Unit::TestCase
|
|
447
447
|
@i.configure(config_element('ROOT', '', {}, [config_element('buffer', '')]))
|
448
448
|
validators = @i.placeholder_validators(:path, "/my/path/${tag}/${username}/file.%Y%m%d_%H%M.log")
|
449
449
|
assert_equal 3, validators.size
|
450
|
-
assert_equal 1, validators.
|
451
|
-
assert_equal 1, validators.
|
452
|
-
assert_equal 1, validators.
|
450
|
+
assert_equal 1, validators.count(&:time?)
|
451
|
+
assert_equal 1, validators.count(&:tag?)
|
452
|
+
assert_equal 1, validators.count(&:keys?)
|
453
453
|
end
|
454
454
|
|
455
455
|
test 'returns validators for time, tag and keys when a plugin is configured with these keys even if a template does not have placeholders' do
|
456
456
|
@i.configure(config_element('ROOT', '', {}, [config_element('buffer', 'time,tag,username', {'timekey' => 60})]))
|
457
457
|
validators = @i.placeholder_validators(:path, "/my/path/file.log")
|
458
458
|
assert_equal 3, validators.size
|
459
|
-
assert_equal 1, validators.
|
460
|
-
assert_equal 1, validators.
|
461
|
-
assert_equal 1, validators.
|
459
|
+
assert_equal 1, validators.count(&:time?)
|
460
|
+
assert_equal 1, validators.count(&:tag?)
|
461
|
+
assert_equal 1, validators.count(&:keys?)
|
462
462
|
end
|
463
463
|
|
464
464
|
test 'returns a validator for time if a template has timestamp placeholders' do
|
465
465
|
@i.configure(config_element('ROOT', '', {}, [config_element('buffer', '')]))
|
466
466
|
validators = @i.placeholder_validators(:path, "/my/path/file.%Y-%m-%d.log")
|
467
467
|
assert_equal 1, validators.size
|
468
|
-
assert_equal 1, validators.
|
468
|
+
assert_equal 1, validators.count(&:time?)
|
469
469
|
assert_raise Fluent::ConfigError.new("Parameter 'path: /my/path/file.%Y-%m-%d.log' has timestamp placeholders, but chunk key 'time' is not configured") do
|
470
470
|
validators.first.validate!
|
471
471
|
end
|
@@ -475,7 +475,7 @@ class OutputTest < Test::Unit::TestCase
|
|
475
475
|
@i.configure(config_element('ROOT', '', {}, [config_element('buffer', 'time', {'timekey' => '30'})]))
|
476
476
|
validators = @i.placeholder_validators(:path, "/my/path/to/file.log")
|
477
477
|
assert_equal 1, validators.size
|
478
|
-
assert_equal 1, validators.
|
478
|
+
assert_equal 1, validators.count(&:time?)
|
479
479
|
assert_raise Fluent::ConfigError.new("Parameter 'path: /my/path/to/file.log' doesn't have timestamp placeholders for timekey 30") do
|
480
480
|
validators.first.validate!
|
481
481
|
end
|
@@ -485,7 +485,7 @@ class OutputTest < Test::Unit::TestCase
|
|
485
485
|
@i.configure(config_element('ROOT', '', {}, [config_element('buffer', '')]))
|
486
486
|
validators = @i.placeholder_validators(:path, "/my/path/${tag}/file.log")
|
487
487
|
assert_equal 1, validators.size
|
488
|
-
assert_equal 1, validators.
|
488
|
+
assert_equal 1, validators.count(&:tag?)
|
489
489
|
assert_raise Fluent::ConfigError.new("Parameter 'path: /my/path/${tag}/file.log' has tag placeholders, but chunk key 'tag' is not configured") do
|
490
490
|
validators.first.validate!
|
491
491
|
end
|
@@ -495,7 +495,7 @@ class OutputTest < Test::Unit::TestCase
|
|
495
495
|
@i.configure(config_element('ROOT', '', {}, [config_element('buffer', 'tag')]))
|
496
496
|
validators = @i.placeholder_validators(:path, "/my/path/file.log")
|
497
497
|
assert_equal 1, validators.size
|
498
|
-
assert_equal 1, validators.
|
498
|
+
assert_equal 1, validators.count(&:tag?)
|
499
499
|
assert_raise Fluent::ConfigError.new("Parameter 'path: /my/path/file.log' doesn't have tag placeholder") do
|
500
500
|
validators.first.validate!
|
501
501
|
end
|
@@ -505,7 +505,7 @@ class OutputTest < Test::Unit::TestCase
|
|
505
505
|
@i.configure(config_element('ROOT', '', {}, [config_element('buffer', '')]))
|
506
506
|
validators = @i.placeholder_validators(:path, "/my/path/${username}/file.${group}.log")
|
507
507
|
assert_equal 1, validators.size
|
508
|
-
assert_equal 1, validators.
|
508
|
+
assert_equal 1, validators.count(&:keys?)
|
509
509
|
assert_raise Fluent::ConfigError.new("Parameter 'path: /my/path/${username}/file.${group}.log' has placeholders, but chunk keys doesn't have keys group,username") do
|
510
510
|
validators.first.validate!
|
511
511
|
end
|
@@ -515,7 +515,7 @@ class OutputTest < Test::Unit::TestCase
|
|
515
515
|
@i.configure(config_element('ROOT', '', {}, [config_element('buffer', 'username,group')]))
|
516
516
|
validators = @i.placeholder_validators(:path, "/my/path/file.log")
|
517
517
|
assert_equal 1, validators.size
|
518
|
-
assert_equal 1, validators.
|
518
|
+
assert_equal 1, validators.count(&:keys?)
|
519
519
|
assert_raise Fluent::ConfigError.new("Parameter 'path: /my/path/file.log' doesn't have enough placeholders for keys group,username") do
|
520
520
|
validators.first.validate!
|
521
521
|
end
|
@@ -510,7 +510,7 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
510
510
|
logs = @i.log.out.logs.dup
|
511
511
|
@i.start
|
512
512
|
@i.after_start
|
513
|
-
assert{ logs.
|
513
|
+
assert{ logs.count{|log| log.include?('[warn]') } == 0 }
|
514
514
|
end
|
515
515
|
|
516
516
|
test 'a warning reported with 4 chunk keys' do
|
@@ -522,7 +522,7 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
522
522
|
@i.after_start
|
523
523
|
assert_equal ['key1', 'key2', 'key3', 'key4'], @i.chunk_keys
|
524
524
|
|
525
|
-
assert{ logs.
|
525
|
+
assert{ logs.count{|log| log.include?('[warn]: many chunk keys specified, and it may cause too many chunks on your system.') } == 1 }
|
526
526
|
end
|
527
527
|
|
528
528
|
test 'a warning reported with 4 chunk keys including "tag"' do
|
@@ -531,7 +531,7 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
531
531
|
logs = @i.log.out.logs.dup
|
532
532
|
@i.start # this calls `log.reset`... capturing logs about configure must be done before this line
|
533
533
|
@i.after_start
|
534
|
-
assert{ logs.
|
534
|
+
assert{ logs.count{|log| log.include?('[warn]: many chunk keys specified, and it may cause too many chunks on your system.') } == 1 }
|
535
535
|
end
|
536
536
|
|
537
537
|
test 'time key is not included for warned chunk keys' do
|
@@ -540,7 +540,7 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
540
540
|
logs = @i.log.out.logs.dup
|
541
541
|
@i.start
|
542
542
|
@i.after_start
|
543
|
-
assert{ logs.
|
543
|
+
assert{ logs.count{|log| log.include?('[warn]') } == 0 }
|
544
544
|
end
|
545
545
|
end
|
546
546
|
|
@@ -968,8 +968,8 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
968
968
|
waiting(4){ sleep 0.1 until ary.size == 3 }
|
969
969
|
|
970
970
|
assert_equal 3, ary.size
|
971
|
-
assert_equal 2, ary.
|
972
|
-
assert_equal 1, ary.
|
971
|
+
assert_equal 2, ary.count{|e| e[0] == "test.tag.1" }
|
972
|
+
assert_equal 1, ary.count{|e| e[0] == "test.tag.2" }
|
973
973
|
|
974
974
|
Timecop.freeze( Time.parse('2016-04-13 14:04:04 +0900') )
|
975
975
|
|
@@ -985,8 +985,8 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
985
985
|
assert{ @i.buffer.stage.size == 1 && @i.write_count == 2 }
|
986
986
|
|
987
987
|
assert_equal 9, ary.size
|
988
|
-
assert_equal 7, ary.
|
989
|
-
assert_equal 2, ary.
|
988
|
+
assert_equal 7, ary.count{|e| e[0] == "test.tag.1" }
|
989
|
+
assert_equal 2, ary.count{|e| e[0] == "test.tag.2" }
|
990
990
|
|
991
991
|
assert metachecks.all?{|e| e }
|
992
992
|
end
|
@@ -1224,8 +1224,8 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
1224
1224
|
|
1225
1225
|
# events fulfills a chunk (and queued immediately)
|
1226
1226
|
assert_equal 5, ary.size
|
1227
|
-
assert_equal 5, ary.
|
1228
|
-
assert_equal 0, ary.
|
1227
|
+
assert_equal 5, ary.count{|e| e[0] == "test.tag.1" }
|
1228
|
+
assert_equal 0, ary.count{|e| e[0] == "test.tag.2" }
|
1229
1229
|
|
1230
1230
|
Timecop.freeze( Time.parse('2016-04-13 14:04:09 +0900') )
|
1231
1231
|
|
@@ -1249,8 +1249,8 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
1249
1249
|
assert{ @i.buffer.stage.size == 0 && @i.write_count == 3 }
|
1250
1250
|
|
1251
1251
|
assert_equal 11, ary.size
|
1252
|
-
assert_equal 8, ary.
|
1253
|
-
assert_equal 3, ary.
|
1252
|
+
assert_equal 8, ary.count{|e| e[0] == "test.tag.1" }
|
1253
|
+
assert_equal 3, ary.count{|e| e[0] == "test.tag.2" }
|
1254
1254
|
|
1255
1255
|
assert metachecks.all?{|e| e }
|
1256
1256
|
end
|
@@ -1315,8 +1315,8 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
1315
1315
|
|
1316
1316
|
# events fulfills a chunk (and queued immediately)
|
1317
1317
|
assert_equal 5, ary.size
|
1318
|
-
assert_equal 5, ary.
|
1319
|
-
assert_equal 0, ary.
|
1318
|
+
assert_equal 5, ary.count{|e| e[0] == "test.tag.1" }
|
1319
|
+
assert_equal 0, ary.count{|e| e[0] == "test.tag.2" }
|
1320
1320
|
|
1321
1321
|
@i.stop
|
1322
1322
|
@i.before_shutdown
|
@@ -1330,8 +1330,8 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
1330
1330
|
assert{ @i.buffer.stage.size == 0 && @i.buffer.queue.size == 0 && @i.write_count == 3 }
|
1331
1331
|
|
1332
1332
|
assert_equal 11, ary.size
|
1333
|
-
assert_equal 8, ary.
|
1334
|
-
assert_equal 3, ary.
|
1333
|
+
assert_equal 8, ary.count{|e| e[0] == "test.tag.1" }
|
1334
|
+
assert_equal 3, ary.count{|e| e[0] == "test.tag.2" }
|
1335
1335
|
|
1336
1336
|
assert metachecks.all?{|e| e }
|
1337
1337
|
end
|
@@ -1435,8 +1435,8 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
1435
1435
|
|
1436
1436
|
# events fulfills a chunk (and queued immediately)
|
1437
1437
|
assert_equal 5, ary.size
|
1438
|
-
assert_equal 5, ary.
|
1439
|
-
assert_equal 0, ary.
|
1438
|
+
assert_equal 5, ary.count{|e| e[0] == "test.tag.1" }
|
1439
|
+
assert_equal 0, ary.count{|e| e[0] == "test.tag.2" }
|
1440
1440
|
assert ary[0...5].all?{|e| e[2]["name"] == "xxx" && e[2]["service"] == "a" }
|
1441
1441
|
|
1442
1442
|
Timecop.freeze( Time.parse('2016-04-13 14:04:09 +0900') )
|
@@ -1465,11 +1465,11 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
1465
1465
|
assert{ @i.buffer.stage.size == 0 && @i.write_count == 4 }
|
1466
1466
|
|
1467
1467
|
assert_equal 11, ary.size
|
1468
|
-
assert_equal 8, ary.
|
1469
|
-
assert_equal 3, ary.
|
1470
|
-
assert_equal 6, ary.
|
1471
|
-
assert_equal 3, ary.
|
1472
|
-
assert_equal 2, ary.
|
1468
|
+
assert_equal 8, ary.count{|e| e[0] == "test.tag.1" }
|
1469
|
+
assert_equal 3, ary.count{|e| e[0] == "test.tag.2" }
|
1470
|
+
assert_equal 6, ary.count{|e| e[2]["name"] == "xxx" && e[2]["service"] == "a" }
|
1471
|
+
assert_equal 3, ary.count{|e| e[2]["name"] == "yyy" && e[2]["service"] == "a" }
|
1472
|
+
assert_equal 2, ary.count{|e| e[2]["name"] == "xxx" && e[2]["service"] == "b" }
|
1473
1473
|
|
1474
1474
|
assert metachecks.all?{|e| e }
|
1475
1475
|
end
|
@@ -1525,8 +1525,8 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
1525
1525
|
|
1526
1526
|
# events fulfills a chunk (and queued immediately)
|
1527
1527
|
assert_equal 5, ary.size
|
1528
|
-
assert_equal 5, ary.
|
1529
|
-
assert_equal 0, ary.
|
1528
|
+
assert_equal 5, ary.count{|e| e[0] == "test.tag.1" }
|
1529
|
+
assert_equal 0, ary.count{|e| e[0] == "test.tag.2" }
|
1530
1530
|
|
1531
1531
|
@i.stop
|
1532
1532
|
@i.before_shutdown
|
@@ -1540,11 +1540,11 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
1540
1540
|
assert{ @i.buffer.stage.size == 0 && @i.buffer.queue.size == 0 && @i.write_count == 4 }
|
1541
1541
|
|
1542
1542
|
assert_equal 11, ary.size
|
1543
|
-
assert_equal 8, ary.
|
1544
|
-
assert_equal 3, ary.
|
1545
|
-
assert_equal 6, ary.
|
1546
|
-
assert_equal 3, ary.
|
1547
|
-
assert_equal 2, ary.
|
1543
|
+
assert_equal 8, ary.count{|e| e[0] == "test.tag.1" }
|
1544
|
+
assert_equal 3, ary.count{|e| e[0] == "test.tag.2" }
|
1545
|
+
assert_equal 6, ary.count{|e| e[2]["name"] == "xxx" && e[2]["service"] == "a" }
|
1546
|
+
assert_equal 3, ary.count{|e| e[2]["name"] == "yyy" && e[2]["service"] == "a" }
|
1547
|
+
assert_equal 2, ary.count{|e| e[2]["name"] == "xxx" && e[2]["service"] == "b" }
|
1548
1548
|
|
1549
1549
|
assert metachecks.all?{|e| e }
|
1550
1550
|
end
|
@@ -1683,8 +1683,8 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
1683
1683
|
|
1684
1684
|
# events fulfills a chunk (and queued immediately)
|
1685
1685
|
assert_equal 5, ary.size
|
1686
|
-
assert_equal 5, ary.
|
1687
|
-
assert_equal 0, ary.
|
1686
|
+
assert_equal 5, ary.count{|e| e[0] == "test.tag.1" }
|
1687
|
+
assert_equal 0, ary.count{|e| e[0] == "test.tag.2" }
|
1688
1688
|
|
1689
1689
|
assert_equal 1, chunks.size
|
1690
1690
|
assert !chunks.first.empty?
|
@@ -1716,8 +1716,8 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
1716
1716
|
assert{ @i.buffer.dequeued.size == 3 }
|
1717
1717
|
|
1718
1718
|
assert_equal 11, ary.size
|
1719
|
-
assert_equal 8, ary.
|
1720
|
-
assert_equal 3, ary.
|
1719
|
+
assert_equal 8, ary.count{|e| e[0] == "test.tag.1" }
|
1720
|
+
assert_equal 3, ary.count{|e| e[0] == "test.tag.2" }
|
1721
1721
|
|
1722
1722
|
assert_equal 3, chunks.size
|
1723
1723
|
assert chunks.all?{|c| !c.empty? }
|
@@ -1802,8 +1802,8 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
1802
1802
|
|
1803
1803
|
# events fulfills a chunk (and queued immediately)
|
1804
1804
|
assert_equal 5, ary.size
|
1805
|
-
assert_equal 5, ary.
|
1806
|
-
assert_equal 0, ary.
|
1805
|
+
assert_equal 5, ary.count{|e| e[0] == "test.tag.1" }
|
1806
|
+
assert_equal 0, ary.count{|e| e[0] == "test.tag.2" }
|
1807
1807
|
|
1808
1808
|
assert_equal 1, chunks.size
|
1809
1809
|
assert !chunks.first.empty?
|
@@ -1835,8 +1835,8 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
1835
1835
|
assert{ @i.buffer.dequeued.size == 3 }
|
1836
1836
|
|
1837
1837
|
assert_equal 11, ary.size
|
1838
|
-
assert_equal 8, ary.
|
1839
|
-
assert_equal 3, ary.
|
1838
|
+
assert_equal 8, ary.count{|e| e[0] == "test.tag.1" }
|
1839
|
+
assert_equal 3, ary.count{|e| e[0] == "test.tag.2" }
|
1840
1840
|
|
1841
1841
|
assert_equal 3, chunks.size
|
1842
1842
|
assert chunks.all?{|c| !c.empty? }
|
@@ -1892,8 +1892,8 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
1892
1892
|
|
1893
1893
|
assert{ @i.write_count == 7 }
|
1894
1894
|
assert_equal 11, ary.size
|
1895
|
-
assert_equal 8, ary.
|
1896
|
-
assert_equal 3, ary.
|
1895
|
+
assert_equal 8, ary.count{|e| e[0] == "test.tag.1" }
|
1896
|
+
assert_equal 3, ary.count{|e| e[0] == "test.tag.2" }
|
1897
1897
|
assert{ chunks.size == 3 }
|
1898
1898
|
assert{ chunks.all?{|c| !c.empty? } }
|
1899
1899
|
|
@@ -1963,8 +1963,8 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
1963
1963
|
|
1964
1964
|
# events fulfills a chunk (and queued immediately)
|
1965
1965
|
assert_equal 5, ary.size
|
1966
|
-
assert_equal 5, ary.
|
1967
|
-
assert_equal 0, ary.
|
1966
|
+
assert_equal 5, ary.count{|e| e[0] == "test.tag.1" }
|
1967
|
+
assert_equal 0, ary.count{|e| e[0] == "test.tag.2" }
|
1968
1968
|
|
1969
1969
|
assert_equal 1, chunks.size
|
1970
1970
|
assert !chunks.first.empty?
|
@@ -1999,8 +1999,8 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
1999
1999
|
assert{ @i.rollback_count == 0 }
|
2000
2000
|
|
2001
2001
|
assert_equal 11, ary.size
|
2002
|
-
assert_equal 8, ary.
|
2003
|
-
assert_equal 3, ary.
|
2002
|
+
assert_equal 8, ary.count{|e| e[0] == "test.tag.1" }
|
2003
|
+
assert_equal 3, ary.count{|e| e[0] == "test.tag.2" }
|
2004
2004
|
|
2005
2005
|
assert{ chunks.size == 3 }
|
2006
2006
|
assert{ chunks.all?{|c| !c.empty? } }
|
@@ -93,7 +93,7 @@ class BufferedOutputRetryTest < Test::Unit::TestCase
|
|
93
93
|
end
|
94
94
|
def get_log_time(msg, logs)
|
95
95
|
log_time = nil
|
96
|
-
log = logs.
|
96
|
+
log = logs.find{|l| l.include?(msg) }
|
97
97
|
if log && /^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} [-+]\d{4}) \[error\]/ =~ log
|
98
98
|
log_time = Time.parse($1)
|
99
99
|
end
|
@@ -634,8 +634,8 @@ class BufferedOutputSecondaryTest < Test::Unit::TestCase
|
|
634
634
|
|
635
635
|
assert @i.retry
|
636
636
|
logs = @i.log.out.logs
|
637
|
-
waiting(4){ sleep 0.1 until logs.
|
638
|
-
assert{ logs.
|
637
|
+
waiting(4){ sleep 0.1 until logs.count{|l| l.include?("[warn]: failed to flush the buffer chunk, timeout to commit.") } == 2 }
|
638
|
+
assert{ logs.count{|l| l.include?("[warn]: failed to flush the buffer chunk, timeout to commit.") } == 2 }
|
639
639
|
end
|
640
640
|
|
641
641
|
test 'retry_wait for secondary is same with one for primary' do
|
@@ -559,7 +559,7 @@ class ChildProcessTest < Test::Unit::TestCase
|
|
559
559
|
unless Fluent.windows?
|
560
560
|
test 'can specify subprocess name' do
|
561
561
|
io = IO.popen([["cat", "caaaaaaaaaaat"], '-'])
|
562
|
-
process_naming_enabled = (open("|ps opid,cmd"){|_io| _io.readlines }.
|
562
|
+
process_naming_enabled = (open("|ps opid,cmd"){|_io| _io.readlines }.count{|line| line.include?("caaaaaaaaaaat") } > 0)
|
563
563
|
Process.kill(:TERM, io.pid) rescue nil
|
564
564
|
io.close rescue nil
|
565
565
|
|
@@ -584,7 +584,7 @@ class ChildProcessTest < Test::Unit::TestCase
|
|
584
584
|
m.lock
|
585
585
|
pid = pids.first
|
586
586
|
# 16357 sleeeeeeeeeper -e sleep 10; puts "hello"
|
587
|
-
assert{ proc_lines.
|
587
|
+
assert{ proc_lines.find{|line| line =~ /^\s*#{pid}\s/ }.strip.split(/\s+/)[1] == "sleeeeeeeeeper" }
|
588
588
|
@d.stop; @d.shutdown; @d.close; @d.terminate
|
589
589
|
end
|
590
590
|
end
|
@@ -1329,7 +1329,7 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
1329
1329
|
# OpenSSL 1.1.1: "TLSv1.2"
|
1330
1330
|
if tls_version == "TLSv1/SSLv3" || tls_version == "TLSv1.2"
|
1331
1331
|
matched = true
|
1332
|
-
unless cipher_name.match(/#{conf.ciphers}/)
|
1332
|
+
unless cipher_name.match?(/#{conf.ciphers}/)
|
1333
1333
|
matched = false
|
1334
1334
|
break
|
1335
1335
|
end
|
data/test/test_log.rb
CHANGED
@@ -472,6 +472,43 @@ class LogTest < Test::Unit::TestCase
|
|
472
472
|
]
|
473
473
|
assert_equal(expected, log.out.logs)
|
474
474
|
end
|
475
|
+
|
476
|
+
def test_reject_on_max_size
|
477
|
+
ignore_same_log_interval = 10
|
478
|
+
|
479
|
+
logger = Fluent::Log.new(
|
480
|
+
ServerEngine::DaemonLogger.new(@log_device, log_level: ServerEngine::DaemonLogger::INFO),
|
481
|
+
ignore_same_log_interval: ignore_same_log_interval,
|
482
|
+
)
|
483
|
+
|
484
|
+
# Output unique log every second.
|
485
|
+
Fluent::Log::IGNORE_SAME_LOG_MAX_CACHE_SIZE.times do |i|
|
486
|
+
logger.info "Test #{i}"
|
487
|
+
Timecop.freeze(@timestamp + i)
|
488
|
+
end
|
489
|
+
logger.info "Over max size!"
|
490
|
+
|
491
|
+
# The newest cache and the latest caches in `ignore_same_log_interval` should exist.
|
492
|
+
assert { Thread.current[:last_same_log].size == ignore_same_log_interval + 1 }
|
493
|
+
end
|
494
|
+
|
495
|
+
def test_clear_on_max_size
|
496
|
+
ignore_same_log_interval = 10
|
497
|
+
|
498
|
+
logger = Fluent::Log.new(
|
499
|
+
ServerEngine::DaemonLogger.new(@log_device, log_level: ServerEngine::DaemonLogger::INFO),
|
500
|
+
ignore_same_log_interval: ignore_same_log_interval,
|
501
|
+
)
|
502
|
+
|
503
|
+
# Output unique log at the same time.
|
504
|
+
Fluent::Log::IGNORE_SAME_LOG_MAX_CACHE_SIZE.times do |i|
|
505
|
+
logger.info "Test #{i}"
|
506
|
+
end
|
507
|
+
logger.info "Over max size!"
|
508
|
+
|
509
|
+
# Can't reject old logs, so all cache should be cleared and only the newest should exist.
|
510
|
+
assert { Thread.current[:last_same_log].size == 1 }
|
511
|
+
end
|
475
512
|
end
|
476
513
|
|
477
514
|
def test_dup
|
@@ -660,7 +697,7 @@ class LogTest < Test::Unit::TestCase
|
|
660
697
|
log.reopen!
|
661
698
|
log.info message
|
662
699
|
|
663
|
-
assert { path.read.lines.
|
700
|
+
assert { path.read.lines.count{ |line| line.include?(message) } == 2 }
|
664
701
|
# Assert reopening the same file.
|
665
702
|
# Especially, on Windows, the filepath is fixed for each process with rotate,
|
666
703
|
# so we need to care about this.
|
@@ -15,4 +15,36 @@ class MessagePackFactoryTest < Test::Unit::TestCase
|
|
15
15
|
assert mp.msgpack_factory
|
16
16
|
assert mp.msgpack_factory
|
17
17
|
end
|
18
|
+
|
19
|
+
sub_test_case 'thread_local_msgpack_packer' do
|
20
|
+
test 'packer is cached' do
|
21
|
+
packer1 = Fluent::MessagePackFactory.thread_local_msgpack_packer
|
22
|
+
packer2 = Fluent::MessagePackFactory.thread_local_msgpack_packer
|
23
|
+
assert_equal packer1, packer2
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
sub_test_case 'thread_local_msgpack_unpacker' do
|
28
|
+
test 'unpacker is cached' do
|
29
|
+
unpacker1 = Fluent::MessagePackFactory.thread_local_msgpack_unpacker
|
30
|
+
unpacker2 = Fluent::MessagePackFactory.thread_local_msgpack_unpacker
|
31
|
+
assert_equal unpacker1, unpacker2
|
32
|
+
end
|
33
|
+
|
34
|
+
# We need to reset the buffer every time so that received incomplete data
|
35
|
+
# must not affect data from other senders.
|
36
|
+
test 'reset the internal buffer of unpacker every time' do
|
37
|
+
unpacker1 = Fluent::MessagePackFactory.thread_local_msgpack_unpacker
|
38
|
+
unpacker1.feed_each("\xA6foo") do |result|
|
39
|
+
flunk("This callback must not be called since the data is uncomplete.")
|
40
|
+
end
|
41
|
+
|
42
|
+
records = []
|
43
|
+
unpacker2 = Fluent::MessagePackFactory.thread_local_msgpack_unpacker
|
44
|
+
unpacker2.feed_each("\xA3foo") do |result|
|
45
|
+
records.append(result)
|
46
|
+
end
|
47
|
+
assert_equal ["foo"], records
|
48
|
+
end
|
49
|
+
end
|
18
50
|
end
|
data/test/test_supervisor.rb
CHANGED
@@ -621,6 +621,19 @@ class SupervisorTest < ::Test::Unit::TestCase
|
|
621
621
|
assert_equal 10, $log.out.instance_variable_get(:@shift_size)
|
622
622
|
end
|
623
623
|
|
624
|
+
def test_can_start_with_rotate_but_no_log_path
|
625
|
+
config_path = "#{@tmp_dir}/empty.conf"
|
626
|
+
write_config config_path, ""
|
627
|
+
|
628
|
+
sv = Fluent::Supervisor.new(
|
629
|
+
config_path: config_path,
|
630
|
+
log_rotate_age: 5,
|
631
|
+
)
|
632
|
+
sv.__send__(:setup_global_logger)
|
633
|
+
|
634
|
+
assert_true $log.stdout?
|
635
|
+
end
|
636
|
+
|
624
637
|
sub_test_case "system log rotation" do
|
625
638
|
def parse_text(text)
|
626
639
|
basepath = File.expand_path(File.dirname(__FILE__) + '/../../')
|
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.16.
|
4
|
+
version: 1.16.2
|
5
5
|
platform: x64-mingw-ucrt
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -124,14 +124,14 @@ dependencies:
|
|
124
124
|
requirements:
|
125
125
|
- - "~>"
|
126
126
|
- !ruby/object:Gem::Version
|
127
|
-
version: 0.2.
|
127
|
+
version: 0.2.5
|
128
128
|
type: :runtime
|
129
129
|
prerelease: false
|
130
130
|
version_requirements: !ruby/object:Gem::Requirement
|
131
131
|
requirements:
|
132
132
|
- - "~>"
|
133
133
|
- !ruby/object:Gem::Version
|
134
|
-
version: 0.2.
|
134
|
+
version: 0.2.5
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: tzinfo
|
137
137
|
requirement: !ruby/object:Gem::Requirement
|