fluentd 1.15.3-x64-mingw32 → 1.16.1-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.yaml +1 -0
- data/.github/ISSUE_TEMPLATE/feature_request.yaml +1 -0
- data/.github/workflows/linux-test.yaml +2 -2
- data/.github/workflows/macos-test.yaml +2 -2
- data/.github/workflows/stale-actions.yml +24 -0
- data/.github/workflows/windows-test.yaml +2 -2
- data/CHANGELOG.md +114 -0
- data/CONTRIBUTING.md +1 -1
- data/MAINTAINERS.md +5 -3
- data/README.md +0 -1
- data/SECURITY.md +5 -9
- data/fluentd.gemspec +2 -2
- data/lib/fluent/command/fluentd.rb +55 -53
- data/lib/fluent/daemon.rb +2 -4
- data/lib/fluent/event.rb +2 -2
- data/lib/fluent/log/console_adapter.rb +66 -0
- data/lib/fluent/log.rb +35 -5
- data/lib/fluent/plugin/base.rb +5 -7
- data/lib/fluent/plugin/buf_file.rb +32 -3
- data/lib/fluent/plugin/buf_file_single.rb +32 -3
- data/lib/fluent/plugin/buffer/file_chunk.rb +1 -1
- data/lib/fluent/plugin/buffer.rb +21 -0
- data/lib/fluent/plugin/in_tcp.rb +47 -2
- data/lib/fluent/plugin/out_forward/ack_handler.rb +19 -4
- data/lib/fluent/plugin/out_forward.rb +2 -2
- data/lib/fluent/plugin/out_secondary_file.rb +39 -22
- data/lib/fluent/plugin/output.rb +49 -12
- data/lib/fluent/plugin_helper/http_server/server.rb +2 -1
- data/lib/fluent/plugin_helper/server.rb +8 -0
- data/lib/fluent/supervisor.rb +157 -251
- data/lib/fluent/test/driver/base.rb +11 -5
- data/lib/fluent/test/driver/filter.rb +4 -0
- data/lib/fluent/test/startup_shutdown.rb +6 -8
- data/lib/fluent/version.rb +1 -1
- data/templates/new_gem/test/helper.rb.erb +0 -1
- data/test/command/test_ctl.rb +1 -1
- data/test/command/test_fluentd.rb +137 -6
- data/test/command/test_plugin_config_formatter.rb +0 -1
- data/test/compat/test_parser.rb +5 -5
- data/test/config/test_system_config.rb +0 -8
- data/test/log/test_console_adapter.rb +110 -0
- data/test/plugin/out_forward/test_ack_handler.rb +39 -0
- data/test/plugin/test_base.rb +98 -0
- data/test/plugin/test_buf_file.rb +62 -23
- data/test/plugin/test_buf_file_single.rb +65 -0
- data/test/plugin/test_in_http.rb +2 -3
- data/test/plugin/test_in_monitor_agent.rb +2 -3
- data/test/plugin/test_in_tcp.rb +87 -2
- data/test/plugin/test_in_udp.rb +28 -0
- data/test/plugin/test_out_forward.rb +14 -18
- data/test/plugin/test_out_http.rb +1 -0
- data/test/plugin/test_output.rb +269 -0
- data/test/plugin/test_output_as_buffered_compress.rb +32 -18
- data/test/plugin/test_parser_regexp.rb +1 -6
- data/test/plugin_helper/test_http_server_helper.rb +1 -1
- data/test/plugin_helper/test_server.rb +59 -5
- data/test/test_config.rb +0 -21
- data/test/test_formatter.rb +23 -20
- data/test/test_log.rb +71 -36
- data/test/test_supervisor.rb +277 -282
- metadata +13 -19
- data/.drone.yml +0 -35
- data/.gitlab-ci.yml +0 -103
- data/test/test_logger_initializer.rb +0 -46
data/test/test_log.rb
CHANGED
@@ -5,6 +5,7 @@ require 'fluent/log'
|
|
5
5
|
require 'timecop'
|
6
6
|
require 'logger'
|
7
7
|
require 'securerandom'
|
8
|
+
require 'pathname'
|
8
9
|
|
9
10
|
class LogTest < Test::Unit::TestCase
|
10
11
|
def tmp_dir
|
@@ -33,6 +34,14 @@ class LogTest < Test::Unit::TestCase
|
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
37
|
+
def test_per_process_path
|
38
|
+
path = Fluent::Log.per_process_path("C:/tmp/test.log", :supervisor, 0)
|
39
|
+
assert_equal(path, "C:/tmp/test-supervisor-0.log")
|
40
|
+
|
41
|
+
path = Fluent::Log.per_process_path("C:/tmp/test.log", :worker, 1)
|
42
|
+
assert_equal(path, "C:/tmp/test-1.log")
|
43
|
+
end
|
44
|
+
|
36
45
|
sub_test_case "log level" do
|
37
46
|
data(
|
38
47
|
trace: [Fluent::Log::LEVEL_TRACE, 0],
|
@@ -593,45 +602,71 @@ class LogTest < Test::Unit::TestCase
|
|
593
602
|
|
594
603
|
def test_log_rotates_specified_size_with_logdevio
|
595
604
|
with_timezone('utc') do
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
605
|
+
begin
|
606
|
+
rotate_age = 2
|
607
|
+
rotate_size = 100
|
608
|
+
path = "#{@tmp_dir}/log-dev-io-#{rotate_size}-#{rotate_age}"
|
609
|
+
path0 = path + '.0'
|
610
|
+
path1 = path + '.1'
|
611
|
+
|
612
|
+
logdev = Fluent::LogDeviceIO.new(path, shift_age: rotate_age, shift_size: rotate_size)
|
613
|
+
logger = ServerEngine::DaemonLogger.new(logdev)
|
614
|
+
log = Fluent::Log.new(logger)
|
615
|
+
|
616
|
+
msg = 'a' * 101
|
617
|
+
log.info msg
|
618
|
+
assert_match msg, File.read(path)
|
619
|
+
assert_true File.exist?(path)
|
620
|
+
assert_true !File.exist?(path0)
|
621
|
+
assert_true !File.exist?(path1)
|
622
|
+
|
623
|
+
# create log.0
|
624
|
+
msg2 = 'b' * 101
|
625
|
+
log.info msg2
|
626
|
+
c = File.read(path)
|
627
|
+
c0 = File.read(path0)
|
628
|
+
assert_match msg2, c
|
629
|
+
assert_match msg, c0
|
630
|
+
assert_true File.exist?(path)
|
631
|
+
assert_true File.exist?(path0)
|
632
|
+
assert_true !File.exist?(path1)
|
633
|
+
|
634
|
+
# rotate
|
635
|
+
msg3 = 'c' * 101
|
636
|
+
log.info msg3
|
637
|
+
c = File.read(path)
|
638
|
+
c0 = File.read(path0)
|
639
|
+
assert_match msg3, c
|
640
|
+
assert_match msg2, c0
|
641
|
+
assert_true File.exist?(path)
|
642
|
+
assert_true File.exist?(path0)
|
643
|
+
assert_true !File.exist?(path1)
|
644
|
+
ensure
|
645
|
+
logdev&.close
|
646
|
+
end
|
647
|
+
end
|
648
|
+
end
|
601
649
|
|
602
|
-
|
603
|
-
|
604
|
-
log = Fluent::Log.new(logger)
|
650
|
+
def test_reopen
|
651
|
+
path = Pathname(@tmp_dir) + "fluent.log"
|
605
652
|
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
assert_true File.exist?(path)
|
610
|
-
assert_true !File.exist?(path0)
|
611
|
-
assert_true !File.exist?(path1)
|
653
|
+
logdev = Fluent::LogDeviceIO.new(path.to_s)
|
654
|
+
logger = ServerEngine::DaemonLogger.new(logdev)
|
655
|
+
log = Fluent::Log.new(logger, path: path)
|
612
656
|
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
log.info msg3
|
627
|
-
c = File.read(path)
|
628
|
-
c0 = File.read(path0)
|
629
|
-
assert_match msg3, c
|
630
|
-
assert_match msg2, c0
|
631
|
-
assert_true File.exist?(path)
|
632
|
-
assert_true File.exist?(path0)
|
633
|
-
assert_true !File.exist?(path1)
|
634
|
-
end
|
657
|
+
message = "This is test message."
|
658
|
+
|
659
|
+
log.info message
|
660
|
+
log.reopen!
|
661
|
+
log.info message
|
662
|
+
|
663
|
+
assert { path.read.lines.select{ |line| line.include?(message) }.size == 2 }
|
664
|
+
# Assert reopening the same file.
|
665
|
+
# Especially, on Windows, the filepath is fixed for each process with rotate,
|
666
|
+
# so we need to care about this.
|
667
|
+
assert { path.parent.entries.size == 3 } # [".", "..", "fluent.log"]
|
668
|
+
ensure
|
669
|
+
logdev&.close
|
635
670
|
end
|
636
671
|
end
|
637
672
|
|