fluentd 1.11.5-x86-mingw32 → 1.12.0-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fluentd might be problematic. Click here for more details.
- checksums.yaml +4 -4
 - data/.github/ISSUE_TEMPLATE/bug_report.md +1 -1
 - data/.github/ISSUE_TEMPLATE/config.yml +5 -0
 - data/.github/workflows/stale-actions.yml +22 -0
 - data/.travis.yml +22 -2
 - data/CHANGELOG.md +38 -0
 - data/README.md +1 -1
 - data/appveyor.yml +3 -0
 - data/bin/fluent-cap-ctl +7 -0
 - data/bin/fluent-ctl +7 -0
 - data/fluentd.gemspec +1 -0
 - data/lib/fluent/capability.rb +87 -0
 - data/lib/fluent/command/cap_ctl.rb +174 -0
 - data/lib/fluent/command/ctl.rb +177 -0
 - data/lib/fluent/command/plugin_config_formatter.rb +2 -1
 - data/lib/fluent/env.rb +4 -0
 - data/lib/fluent/plugin.rb +5 -0
 - data/lib/fluent/plugin/buffer.rb +2 -21
 - data/lib/fluent/plugin/formatter.rb +2 -2
 - data/lib/fluent/plugin/formatter_csv.rb +1 -1
 - data/lib/fluent/plugin/formatter_hash.rb +1 -1
 - data/lib/fluent/plugin/formatter_ltsv.rb +3 -3
 - data/lib/fluent/plugin/formatter_out_file.rb +3 -3
 - data/lib/fluent/plugin/formatter_single_value.rb +2 -2
 - data/lib/fluent/plugin/formatter_tsv.rb +2 -2
 - data/lib/fluent/plugin/in_http.rb +23 -2
 - data/lib/fluent/plugin/in_tail.rb +109 -41
 - data/lib/fluent/plugin/in_tail/position_file.rb +39 -14
 - data/lib/fluent/plugin/in_tcp.rb +1 -0
 - data/lib/fluent/plugin/output.rb +7 -1
 - data/lib/fluent/plugin_helper/http_server/compat/server.rb +1 -1
 - data/lib/fluent/plugin_helper/inject.rb +4 -2
 - data/lib/fluent/plugin_helper/retry_state.rb +4 -0
 - data/lib/fluent/supervisor.rb +140 -42
 - data/lib/fluent/time.rb +1 -0
 - data/lib/fluent/version.rb +1 -1
 - data/lib/fluent/winsvc.rb +22 -4
 - data/test/command/test_cap_ctl.rb +100 -0
 - data/test/command/test_ctl.rb +57 -0
 - data/test/command/test_plugin_config_formatter.rb +57 -2
 - data/test/plugin/in_tail/test_position_file.rb +45 -25
 - data/test/plugin/test_in_http.rb +25 -0
 - data/test/plugin/test_in_tail.rb +430 -30
 - data/test/plugin/test_parser_syslog.rb +2 -2
 - data/test/plugin_helper/test_inject.rb +29 -0
 - data/test/test_capability.rb +74 -0
 - data/test/test_supervisor.rb +102 -10
 - metadata +31 -2
 
| 
         @@ -38,7 +38,7 @@ class SyslogParserTest < ::Test::Unit::TestCase 
     | 
|
| 
       38 
38 
     | 
    
         
             
              data('regexp' => 'regexp', 'string' => 'string')
         
     | 
| 
       39 
39 
     | 
    
         
             
              def test_parse_with_time_format2(param)
         
     | 
| 
       40 
40 
     | 
    
         
             
                @parser.configure('time_format' => '%Y-%m-%dT%H:%M:%SZ', 'parser_type' => param)
         
     | 
| 
       41 
     | 
    
         
            -
                @parser.instance.parse( 
     | 
| 
      
 41 
     | 
    
         
            +
                @parser.instance.parse("#{Time.now.year}-03-03T10:14:29Z 192.168.0.1 fluentd[11111]: [error] Syslog test") { |time, record|
         
     | 
| 
       42 
42 
     | 
    
         
             
                  assert_equal(event_time('Mar 03 10:14:29', format: '%b %d %H:%M:%S'), time)
         
     | 
| 
       43 
43 
     | 
    
         
             
                  assert_equal(@expected, record)
         
     | 
| 
       44 
44 
     | 
    
         
             
                }
         
     | 
| 
         @@ -47,7 +47,7 @@ class SyslogParserTest < ::Test::Unit::TestCase 
     | 
|
| 
       47 
47 
     | 
    
         | 
| 
       48 
48 
     | 
    
         
             
              def test_parse_with_time_format_rfc5424
         
     | 
| 
       49 
49 
     | 
    
         
             
                @parser.configure('time_format' => '%Y-%m-%dT%H:%M:%SZ', 'message_format' => 'rfc5424')
         
     | 
| 
       50 
     | 
    
         
            -
                @parser.instance.parse( 
     | 
| 
      
 50 
     | 
    
         
            +
                @parser.instance.parse("#{Time.now.year}-03-03T10:14:29Z 192.168.0.1 fluentd 11111 - - [error] Syslog test") { |time, record|
         
     | 
| 
       51 
51 
     | 
    
         
             
                  assert_equal(event_time('Mar 03 10:14:29', format: '%b %d %H:%M:%S'), time)
         
     | 
| 
       52 
52 
     | 
    
         
             
                  assert_equal(@expected.merge('host' => '192.168.0.1', 'msgid' => '-', 'extradata' => '-'), record)
         
     | 
| 
       53 
53 
     | 
    
         
             
                }
         
     | 
| 
         @@ -187,6 +187,35 @@ class InjectHelperTest < Test::Unit::TestCase 
     | 
|
| 
       187 
187 
     | 
    
         | 
| 
       188 
188 
     | 
    
         
             
                  record = {"key1" => "value1", "key2" => 2}
         
     | 
| 
       189 
189 
     | 
    
         
             
                  assert_equal record.merge({"timedata" => unixtime_millis}), @d.inject_values_to_record('tag', time, record)
         
     | 
| 
      
 190 
     | 
    
         
            +
                  assert_equal record.merge({"timedata" => time_in_unix * 1_000}), @d.inject_values_to_record('tag', time_in_unix, record)
         
     | 
| 
      
 191 
     | 
    
         
            +
                end
         
     | 
| 
      
 192 
     | 
    
         
            +
             
     | 
| 
      
 193 
     | 
    
         
            +
                test 'injects time as unix time micros into specified key' do
         
     | 
| 
      
 194 
     | 
    
         
            +
                  time_in_unix = Time.parse("2016-06-21 08:10:11 +0900").to_i
         
     | 
| 
      
 195 
     | 
    
         
            +
                  time_subsecond = 320_101_224
         
     | 
| 
      
 196 
     | 
    
         
            +
                  time = Fluent::EventTime.new(time_in_unix, time_subsecond)
         
     | 
| 
      
 197 
     | 
    
         
            +
                  unixtime_micros = 1466464211320101
         
     | 
| 
      
 198 
     | 
    
         
            +
             
     | 
| 
      
 199 
     | 
    
         
            +
                  @d.configure(config_inject_section("time_key" => "timedata", "time_type" => "unixtime_micros"))
         
     | 
| 
      
 200 
     | 
    
         
            +
                  @d.start
         
     | 
| 
      
 201 
     | 
    
         
            +
             
     | 
| 
      
 202 
     | 
    
         
            +
                  record = {"key1" => "value1", "key2" => 2}
         
     | 
| 
      
 203 
     | 
    
         
            +
                  assert_equal record.merge({"timedata" => unixtime_micros}), @d.inject_values_to_record('tag', time, record)
         
     | 
| 
      
 204 
     | 
    
         
            +
                  assert_equal record.merge({"timedata" => time_in_unix * 1_000_000}), @d.inject_values_to_record('tag', time_in_unix, record)
         
     | 
| 
      
 205 
     | 
    
         
            +
                end
         
     | 
| 
      
 206 
     | 
    
         
            +
             
     | 
| 
      
 207 
     | 
    
         
            +
                test 'injects time as unix time nanos into specified key' do
         
     | 
| 
      
 208 
     | 
    
         
            +
                  time_in_unix = Time.parse("2016-06-21 08:10:11 +0900").to_i
         
     | 
| 
      
 209 
     | 
    
         
            +
                  time_subsecond = 320_101_224
         
     | 
| 
      
 210 
     | 
    
         
            +
                  time = Fluent::EventTime.new(time_in_unix, time_subsecond)
         
     | 
| 
      
 211 
     | 
    
         
            +
                  unixtime_nanos = 1466464211320101224
         
     | 
| 
      
 212 
     | 
    
         
            +
             
     | 
| 
      
 213 
     | 
    
         
            +
                  @d.configure(config_inject_section("time_key" => "timedata", "time_type" => "unixtime_nanos"))
         
     | 
| 
      
 214 
     | 
    
         
            +
                  @d.start
         
     | 
| 
      
 215 
     | 
    
         
            +
             
     | 
| 
      
 216 
     | 
    
         
            +
                  record = {"key1" => "value1", "key2" => 2}
         
     | 
| 
      
 217 
     | 
    
         
            +
                  assert_equal record.merge({"timedata" => unixtime_nanos}), @d.inject_values_to_record('tag', time, record)
         
     | 
| 
      
 218 
     | 
    
         
            +
                  assert_equal record.merge({"timedata" => time_in_unix * 1_000_000_000}), @d.inject_values_to_record('tag', time_in_unix, record)
         
     | 
| 
       190 
219 
     | 
    
         
             
                end
         
     | 
| 
       191 
220 
     | 
    
         | 
| 
       192 
221 
     | 
    
         
             
                test 'injects time as unix time into specified key' do
         
     | 
| 
         @@ -0,0 +1,74 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative 'helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'fluent/test'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'fluent/capability'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            class FluentCapabilityTest < ::Test::Unit::TestCase
         
     | 
| 
      
 6 
     | 
    
         
            +
              setup do
         
     | 
| 
      
 7 
     | 
    
         
            +
                @capability = Fluent::Capability.new(:current_process)
         
     | 
| 
      
 8 
     | 
    
         
            +
                omit "Fluent::Capability class is not usable on this environment" unless @capability.usable?
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              sub_test_case "check capability" do
         
     | 
| 
      
 12 
     | 
    
         
            +
                test "effective" do
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @capability.clear(:both)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  assert_true @capability.update(:add, :effective, :dac_read_search)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  assert_equal CapNG::Result::PARTIAL, @capability.have_capabilities?(:caps)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  assert_nothing_raised do
         
     | 
| 
      
 17 
     | 
    
         
            +
                    @capability.apply(:caps)
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
                  assert_equal CapNG::Result::NONE, @capability.have_capabilities?(:bounds)
         
     | 
| 
      
 20 
     | 
    
         
            +
                  assert_true @capability.have_capability?(:effective, :dac_read_search)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  assert_false @capability.have_capability?(:inheritable, :dac_read_search)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  assert_false @capability.have_capability?(:permitted, :dac_read_search)
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                test "inheritable" do
         
     | 
| 
      
 26 
     | 
    
         
            +
                  @capability.clear(:both)
         
     | 
| 
      
 27 
     | 
    
         
            +
                  capabilities = [:chown, :dac_override]
         
     | 
| 
      
 28 
     | 
    
         
            +
                  assert_equal [true, true], @capability.update(:add, :inheritable, capabilities)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  assert_equal CapNG::Result::NONE, @capability.have_capabilities?(:caps)
         
     | 
| 
      
 30 
     | 
    
         
            +
                  assert_nothing_raised do
         
     | 
| 
      
 31 
     | 
    
         
            +
                    @capability.apply(:caps)
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
                  assert_equal CapNG::Result::NONE, @capability.have_capabilities?(:bounds)
         
     | 
| 
      
 34 
     | 
    
         
            +
                  capabilities.each do |capability|
         
     | 
| 
      
 35 
     | 
    
         
            +
                    assert_false @capability.have_capability?(:effective, capability)
         
     | 
| 
      
 36 
     | 
    
         
            +
                    assert_true @capability.have_capability?(:inheritable, capability)
         
     | 
| 
      
 37 
     | 
    
         
            +
                    assert_false @capability.have_capability?(:permitted, capability)
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                test "permitted" do
         
     | 
| 
      
 42 
     | 
    
         
            +
                  @capability.clear(:both)
         
     | 
| 
      
 43 
     | 
    
         
            +
                  capabilities = [:fowner, :fsetid, :kill]
         
     | 
| 
      
 44 
     | 
    
         
            +
                  assert_equal [true, true, true], @capability.update(:add, :permitted, capabilities)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  assert_equal CapNG::Result::NONE, @capability.have_capabilities?(:caps)
         
     | 
| 
      
 46 
     | 
    
         
            +
                  assert_nothing_raised do
         
     | 
| 
      
 47 
     | 
    
         
            +
                    @capability.apply(:caps)
         
     | 
| 
      
 48 
     | 
    
         
            +
                  end
         
     | 
| 
      
 49 
     | 
    
         
            +
                  assert_equal CapNG::Result::NONE, @capability.have_capabilities?(:bounds)
         
     | 
| 
      
 50 
     | 
    
         
            +
                  capabilities.each do |capability|
         
     | 
| 
      
 51 
     | 
    
         
            +
                    assert_false @capability.have_capability?(:effective, capability)
         
     | 
| 
      
 52 
     | 
    
         
            +
                    assert_false @capability.have_capability?(:inheritable, capability)
         
     | 
| 
      
 53 
     | 
    
         
            +
                    assert_true @capability.have_capability?(:permitted, capability)
         
     | 
| 
      
 54 
     | 
    
         
            +
                  end
         
     | 
| 
      
 55 
     | 
    
         
            +
                end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                test "effective/inheritable/permitted" do
         
     | 
| 
      
 58 
     | 
    
         
            +
                  @capability.clear(:both)
         
     | 
| 
      
 59 
     | 
    
         
            +
                  capabilities = [:setpcap, :net_admin, :net_raw, :sys_boot, :sys_time]
         
     | 
| 
      
 60 
     | 
    
         
            +
                  update_type = CapNG::Type::EFFECTIVE | CapNG::Type::INHERITABLE | CapNG::Type::PERMITTED
         
     | 
| 
      
 61 
     | 
    
         
            +
                  assert_equal [true, true, true, true, true], @capability.update(:add, update_type, capabilities)
         
     | 
| 
      
 62 
     | 
    
         
            +
                  assert_equal CapNG::Result::PARTIAL, @capability.have_capabilities?(:caps)
         
     | 
| 
      
 63 
     | 
    
         
            +
                  assert_nothing_raised do
         
     | 
| 
      
 64 
     | 
    
         
            +
                    @capability.apply(:caps)
         
     | 
| 
      
 65 
     | 
    
         
            +
                  end
         
     | 
| 
      
 66 
     | 
    
         
            +
                  assert_equal CapNG::Result::NONE, @capability.have_capabilities?(:bounds)
         
     | 
| 
      
 67 
     | 
    
         
            +
                  capabilities.each do |capability|
         
     | 
| 
      
 68 
     | 
    
         
            +
                    assert_true @capability.have_capability?(:effective, capability)
         
     | 
| 
      
 69 
     | 
    
         
            +
                    assert_true @capability.have_capability?(:inheritable, capability)
         
     | 
| 
      
 70 
     | 
    
         
            +
                    assert_true @capability.have_capability?(:permitted, capability)
         
     | 
| 
      
 71 
     | 
    
         
            +
                  end
         
     | 
| 
      
 72 
     | 
    
         
            +
                end
         
     | 
| 
      
 73 
     | 
    
         
            +
              end
         
     | 
| 
      
 74 
     | 
    
         
            +
            end
         
     | 
    
        data/test/test_supervisor.rb
    CHANGED
    
    | 
         @@ -111,6 +111,32 @@ class SupervisorTest < ::Test::Unit::TestCase 
     | 
|
| 
       111 
111 
     | 
    
         
             
                $log.out.reset if $log && $log.out && $log.out.respond_to?(:reset)
         
     | 
| 
       112 
112 
     | 
    
         
             
              end
         
     | 
| 
       113 
113 
     | 
    
         | 
| 
      
 114 
     | 
    
         
            +
              def test_main_process_command_handlers
         
     | 
| 
      
 115 
     | 
    
         
            +
                omit "Only for Windows, alternative to UNIX signals" unless Fluent.windows?
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
                create_info_dummy_logger
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
                opts = Fluent::Supervisor.default_options
         
     | 
| 
      
 120 
     | 
    
         
            +
                sv = Fluent::Supervisor.new(opts)
         
     | 
| 
      
 121 
     | 
    
         
            +
                r, w = IO.pipe
         
     | 
| 
      
 122 
     | 
    
         
            +
                $stdin = r
         
     | 
| 
      
 123 
     | 
    
         
            +
                sv.send(:install_main_process_signal_handlers)
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
                begin
         
     | 
| 
      
 126 
     | 
    
         
            +
                  w.write("GRACEFUL_RESTART\n")
         
     | 
| 
      
 127 
     | 
    
         
            +
                  w.flush
         
     | 
| 
      
 128 
     | 
    
         
            +
                ensure
         
     | 
| 
      
 129 
     | 
    
         
            +
                  $stdin = STDIN
         
     | 
| 
      
 130 
     | 
    
         
            +
                end
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
                sleep 1
         
     | 
| 
      
 133 
     | 
    
         
            +
             
     | 
| 
      
 134 
     | 
    
         
            +
                info_msg = '[info]: force flushing buffered events' + "\n"
         
     | 
| 
      
 135 
     | 
    
         
            +
                assert{ $log.out.logs.first.end_with?(info_msg) }
         
     | 
| 
      
 136 
     | 
    
         
            +
              ensure
         
     | 
| 
      
 137 
     | 
    
         
            +
                $log.out.reset if $log && $log.out && $log.out.respond_to?(:reset)
         
     | 
| 
      
 138 
     | 
    
         
            +
              end
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
       114 
140 
     | 
    
         
             
              def test_supervisor_signal_handler
         
     | 
| 
       115 
141 
     | 
    
         
             
                omit "Windows cannot handle signals" if Fluent.windows?
         
     | 
| 
       116 
142 
     | 
    
         | 
| 
         @@ -137,21 +163,53 @@ class SupervisorTest < ::Test::Unit::TestCase 
     | 
|
| 
       137 
163 
     | 
    
         | 
| 
       138 
164 
     | 
    
         
             
                server = DummyServer.new
         
     | 
| 
       139 
165 
     | 
    
         
             
                def server.config
         
     | 
| 
       140 
     | 
    
         
            -
                  {:signame => "TestFluentdEvent" 
     | 
| 
      
 166 
     | 
    
         
            +
                  {:signame => "TestFluentdEvent"}
         
     | 
| 
       141 
167 
     | 
    
         
             
                end
         
     | 
| 
       142 
168 
     | 
    
         | 
| 
       143 
169 
     | 
    
         
             
                mock(server).stop(true)
         
     | 
| 
       144 
170 
     | 
    
         
             
                stub(Process).kill.times(0)
         
     | 
| 
       145 
171 
     | 
    
         | 
| 
       146 
     | 
    
         
            -
                server.before_run
         
     | 
| 
       147 
172 
     | 
    
         
             
                server.install_windows_event_handler
         
     | 
| 
       148 
     | 
    
         
            -
                 
     | 
| 
       149 
     | 
    
         
            -
             
     | 
| 
       150 
     | 
    
         
            -
             
     | 
| 
       151 
     | 
    
         
            -
             
     | 
| 
       152 
     | 
    
         
            -
             
     | 
| 
       153 
     | 
    
         
            -
                 
     | 
| 
       154 
     | 
    
         
            -
             
     | 
| 
      
 173 
     | 
    
         
            +
                begin
         
     | 
| 
      
 174 
     | 
    
         
            +
                  sleep 0.1 # Wait for starting windows event thread
         
     | 
| 
      
 175 
     | 
    
         
            +
                  event = Win32::Event.open("TestFluentdEvent")
         
     | 
| 
      
 176 
     | 
    
         
            +
                  event.set
         
     | 
| 
      
 177 
     | 
    
         
            +
                  event.close
         
     | 
| 
      
 178 
     | 
    
         
            +
                ensure
         
     | 
| 
      
 179 
     | 
    
         
            +
                  server.stop_windows_event_thread
         
     | 
| 
      
 180 
     | 
    
         
            +
                end
         
     | 
| 
      
 181 
     | 
    
         
            +
             
     | 
| 
      
 182 
     | 
    
         
            +
                debug_msg = '[debug]: Got Win32 event "TestFluentdEvent"'
         
     | 
| 
      
 183 
     | 
    
         
            +
                logs = $log.out.logs
         
     | 
| 
      
 184 
     | 
    
         
            +
                assert{ logs.any?{|log| log.include?(debug_msg) } }
         
     | 
| 
      
 185 
     | 
    
         
            +
              ensure
         
     | 
| 
      
 186 
     | 
    
         
            +
                $log.out.reset if $log && $log.out && $log.out.respond_to?(:reset)
         
     | 
| 
      
 187 
     | 
    
         
            +
              end
         
     | 
| 
      
 188 
     | 
    
         
            +
             
     | 
| 
      
 189 
     | 
    
         
            +
              def test_supervisor_event_handler
         
     | 
| 
      
 190 
     | 
    
         
            +
                omit "Only for Windows, alternative to UNIX signals" unless Fluent.windows?
         
     | 
| 
      
 191 
     | 
    
         
            +
             
     | 
| 
      
 192 
     | 
    
         
            +
                create_debug_dummy_logger
         
     | 
| 
      
 193 
     | 
    
         
            +
             
     | 
| 
      
 194 
     | 
    
         
            +
                server = DummyServer.new
         
     | 
| 
      
 195 
     | 
    
         
            +
                def server.config
         
     | 
| 
      
 196 
     | 
    
         
            +
                  {:signame => "TestFluentdEvent"}
         
     | 
| 
      
 197 
     | 
    
         
            +
                end
         
     | 
| 
      
 198 
     | 
    
         
            +
                server.install_windows_event_handler
         
     | 
| 
      
 199 
     | 
    
         
            +
                begin
         
     | 
| 
      
 200 
     | 
    
         
            +
                  sleep 0.1 # Wait for starting windows event thread
         
     | 
| 
      
 201 
     | 
    
         
            +
                  event = Win32::Event.open("TestFluentdEvent_USR1")
         
     | 
| 
      
 202 
     | 
    
         
            +
                  event.set
         
     | 
| 
      
 203 
     | 
    
         
            +
                  event.close
         
     | 
| 
      
 204 
     | 
    
         
            +
                ensure
         
     | 
| 
      
 205 
     | 
    
         
            +
                  server.stop_windows_event_thread
         
     | 
| 
      
 206 
     | 
    
         
            +
                end
         
     | 
| 
      
 207 
     | 
    
         
            +
             
     | 
| 
      
 208 
     | 
    
         
            +
                debug_msg = '[debug]: Got Win32 event "TestFluentdEvent_USR1"'
         
     | 
| 
      
 209 
     | 
    
         
            +
                logs = $log.out.logs
         
     | 
| 
      
 210 
     | 
    
         
            +
                assert{ logs.any?{|log| log.include?(debug_msg) } }
         
     | 
| 
      
 211 
     | 
    
         
            +
              ensure
         
     | 
| 
      
 212 
     | 
    
         
            +
                $log.out.reset if $log && $log.out && $log.out.respond_to?(:reset)
         
     | 
| 
       155 
213 
     | 
    
         
             
              end
         
     | 
| 
       156 
214 
     | 
    
         | 
| 
       157 
215 
     | 
    
         
             
              def test_rpc_server
         
     | 
| 
         @@ -176,7 +234,7 @@ class SupervisorTest < ::Test::Unit::TestCase 
     | 
|
| 
       176 
234 
     | 
    
         
             
                server.run_rpc_server
         
     | 
| 
       177 
235 
     | 
    
         | 
| 
       178 
236 
     | 
    
         
             
                sv.send(:install_main_process_signal_handlers)
         
     | 
| 
       179 
     | 
    
         
            -
                Net::HTTP.get 
     | 
| 
      
 237 
     | 
    
         
            +
                response = Net::HTTP.get(URI.parse('http://127.0.0.1:24447/api/plugins.flushBuffers'))
         
     | 
| 
       180 
238 
     | 
    
         
             
                info_msg = '[info]: force flushing buffered events' + "\n"
         
     | 
| 
       181 
239 
     | 
    
         | 
| 
       182 
240 
     | 
    
         
             
                server.stop_rpc_server
         
     | 
| 
         @@ -185,11 +243,45 @@ class SupervisorTest < ::Test::Unit::TestCase 
     | 
|
| 
       185 
243 
     | 
    
         
             
                # This test will be passed in such environment.
         
     | 
| 
       186 
244 
     | 
    
         
             
                pend unless $log.out.logs.first
         
     | 
| 
       187 
245 
     | 
    
         | 
| 
      
 246 
     | 
    
         
            +
                assert_equal('{"ok":true}', response)
         
     | 
| 
       188 
247 
     | 
    
         
             
                assert{ $log.out.logs.first.end_with?(info_msg) }
         
     | 
| 
       189 
248 
     | 
    
         
             
              ensure
         
     | 
| 
       190 
249 
     | 
    
         
             
                $log.out.reset if $log.out.is_a?(Fluent::Test::DummyLogDevice)
         
     | 
| 
       191 
250 
     | 
    
         
             
              end
         
     | 
| 
       192 
251 
     | 
    
         | 
| 
      
 252 
     | 
    
         
            +
              def test_rpc_server_windows
         
     | 
| 
      
 253 
     | 
    
         
            +
                omit "Only for windows platform" unless Fluent.windows?
         
     | 
| 
      
 254 
     | 
    
         
            +
             
     | 
| 
      
 255 
     | 
    
         
            +
                create_info_dummy_logger
         
     | 
| 
      
 256 
     | 
    
         
            +
             
     | 
| 
      
 257 
     | 
    
         
            +
                opts = Fluent::Supervisor.default_options
         
     | 
| 
      
 258 
     | 
    
         
            +
                sv = Fluent::Supervisor.new(opts)
         
     | 
| 
      
 259 
     | 
    
         
            +
                conf_data = <<-EOC
         
     | 
| 
      
 260 
     | 
    
         
            +
              <system>
         
     | 
| 
      
 261 
     | 
    
         
            +
                rpc_endpoint 0.0.0.0:24447
         
     | 
| 
      
 262 
     | 
    
         
            +
              </system>
         
     | 
| 
      
 263 
     | 
    
         
            +
                EOC
         
     | 
| 
      
 264 
     | 
    
         
            +
                conf = Fluent::Config.parse(conf_data, "(test)", "(test_dir)", true)
         
     | 
| 
      
 265 
     | 
    
         
            +
                sys_conf = sv.__send__(:build_system_config, conf)
         
     | 
| 
      
 266 
     | 
    
         
            +
             
     | 
| 
      
 267 
     | 
    
         
            +
                server = DummyServer.new
         
     | 
| 
      
 268 
     | 
    
         
            +
                def server.config
         
     | 
| 
      
 269 
     | 
    
         
            +
                  {
         
     | 
| 
      
 270 
     | 
    
         
            +
                    :signame => "TestFluentdEvent",
         
     | 
| 
      
 271 
     | 
    
         
            +
                    :worker_pid => 5963,
         
     | 
| 
      
 272 
     | 
    
         
            +
                  }
         
     | 
| 
      
 273 
     | 
    
         
            +
                end
         
     | 
| 
      
 274 
     | 
    
         
            +
                server.rpc_endpoint = sys_conf.rpc_endpoint
         
     | 
| 
      
 275 
     | 
    
         
            +
             
     | 
| 
      
 276 
     | 
    
         
            +
                server.run_rpc_server
         
     | 
| 
      
 277 
     | 
    
         
            +
             
     | 
| 
      
 278 
     | 
    
         
            +
                mock(server).restart(true) { nil }
         
     | 
| 
      
 279 
     | 
    
         
            +
                response = Net::HTTP.get(URI.parse('http://127.0.0.1:24447/api/plugins.flushBuffers'))
         
     | 
| 
      
 280 
     | 
    
         
            +
             
     | 
| 
      
 281 
     | 
    
         
            +
                server.stop_rpc_server
         
     | 
| 
      
 282 
     | 
    
         
            +
                assert_equal('{"ok":true}', response)
         
     | 
| 
      
 283 
     | 
    
         
            +
              end
         
     | 
| 
      
 284 
     | 
    
         
            +
             
     | 
| 
       193 
285 
     | 
    
         
             
              def test_load_config
         
     | 
| 
       194 
286 
     | 
    
         
             
                tmp_dir = "#{TMP_DIR}/dir/test_load_config.conf"
         
     | 
| 
       195 
287 
     | 
    
         
             
                conf_info_str = %[
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,15 +1,29 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: fluentd
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.12.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: x86-mingw32
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Sadayuki Furuhashi
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2021-01-05 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       13 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
28 
     | 
    
         
             
              name: msgpack
         
     | 
| 
       15 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -415,7 +429,9 @@ email: 
     | 
|
| 
       415 
429 
     | 
    
         
             
            executables:
         
     | 
| 
       416 
430 
     | 
    
         
             
            - fluent-binlog-reader
         
     | 
| 
       417 
431 
     | 
    
         
             
            - fluent-ca-generate
         
     | 
| 
      
 432 
     | 
    
         
            +
            - fluent-cap-ctl
         
     | 
| 
       418 
433 
     | 
    
         
             
            - fluent-cat
         
     | 
| 
      
 434 
     | 
    
         
            +
            - fluent-ctl
         
     | 
| 
       419 
435 
     | 
    
         
             
            - fluent-debug
         
     | 
| 
       420 
436 
     | 
    
         
             
            - fluent-gem
         
     | 
| 
       421 
437 
     | 
    
         
             
            - fluent-plugin-config-format
         
     | 
| 
         @@ -427,9 +443,11 @@ files: 
     | 
|
| 
       427 
443 
     | 
    
         
             
            - ".drone.yml"
         
     | 
| 
       428 
444 
     | 
    
         
             
            - ".github/ISSUE_TEMPLATE.md"
         
     | 
| 
       429 
445 
     | 
    
         
             
            - ".github/ISSUE_TEMPLATE/bug_report.md"
         
     | 
| 
      
 446 
     | 
    
         
            +
            - ".github/ISSUE_TEMPLATE/config.yml"
         
     | 
| 
       430 
447 
     | 
    
         
             
            - ".github/ISSUE_TEMPLATE/feature_request.md"
         
     | 
| 
       431 
448 
     | 
    
         
             
            - ".github/PULL_REQUEST_TEMPLATE.md"
         
     | 
| 
       432 
449 
     | 
    
         
             
            - ".github/workflows/issue-auto-closer.yml"
         
     | 
| 
      
 450 
     | 
    
         
            +
            - ".github/workflows/stale-actions.yml"
         
     | 
| 
       433 
451 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
       434 
452 
     | 
    
         
             
            - ".gitlab-ci.yml"
         
     | 
| 
       435 
453 
     | 
    
         
             
            - ".travis.yml"
         
     | 
| 
         @@ -447,7 +465,9 @@ files: 
     | 
|
| 
       447 
465 
     | 
    
         
             
            - appveyor.yml
         
     | 
| 
       448 
466 
     | 
    
         
             
            - bin/fluent-binlog-reader
         
     | 
| 
       449 
467 
     | 
    
         
             
            - bin/fluent-ca-generate
         
     | 
| 
      
 468 
     | 
    
         
            +
            - bin/fluent-cap-ctl
         
     | 
| 
       450 
469 
     | 
    
         
             
            - bin/fluent-cat
         
     | 
| 
      
 470 
     | 
    
         
            +
            - bin/fluent-ctl
         
     | 
| 
       451 
471 
     | 
    
         
             
            - bin/fluent-debug
         
     | 
| 
       452 
472 
     | 
    
         
             
            - bin/fluent-gem
         
     | 
| 
       453 
473 
     | 
    
         
             
            - bin/fluent-plugin-config-format
         
     | 
| 
         @@ -495,11 +515,14 @@ files: 
     | 
|
| 
       495 
515 
     | 
    
         
             
            - fluent.conf
         
     | 
| 
       496 
516 
     | 
    
         
             
            - fluentd.gemspec
         
     | 
| 
       497 
517 
     | 
    
         
             
            - lib/fluent/agent.rb
         
     | 
| 
      
 518 
     | 
    
         
            +
            - lib/fluent/capability.rb
         
     | 
| 
       498 
519 
     | 
    
         
             
            - lib/fluent/clock.rb
         
     | 
| 
       499 
520 
     | 
    
         
             
            - lib/fluent/command/binlog_reader.rb
         
     | 
| 
       500 
521 
     | 
    
         
             
            - lib/fluent/command/bundler_injection.rb
         
     | 
| 
       501 
522 
     | 
    
         
             
            - lib/fluent/command/ca_generate.rb
         
     | 
| 
      
 523 
     | 
    
         
            +
            - lib/fluent/command/cap_ctl.rb
         
     | 
| 
       502 
524 
     | 
    
         
             
            - lib/fluent/command/cat.rb
         
     | 
| 
      
 525 
     | 
    
         
            +
            - lib/fluent/command/ctl.rb
         
     | 
| 
       503 
526 
     | 
    
         
             
            - lib/fluent/command/debug.rb
         
     | 
| 
       504 
527 
     | 
    
         
             
            - lib/fluent/command/fluentd.rb
         
     | 
| 
       505 
528 
     | 
    
         
             
            - lib/fluent/command/plugin_config_formatter.rb
         
     | 
| 
         @@ -745,6 +768,8 @@ files: 
     | 
|
| 
       745 
768 
     | 
    
         
             
            - templates/plugin_config_formatter/section.md.erb
         
     | 
| 
       746 
769 
     | 
    
         
             
            - test/command/test_binlog_reader.rb
         
     | 
| 
       747 
770 
     | 
    
         
             
            - test/command/test_ca_generate.rb
         
     | 
| 
      
 771 
     | 
    
         
            +
            - test/command/test_cap_ctl.rb
         
     | 
| 
      
 772 
     | 
    
         
            +
            - test/command/test_ctl.rb
         
     | 
| 
       748 
773 
     | 
    
         
             
            - test/command/test_fluentd.rb
         
     | 
| 
       749 
774 
     | 
    
         
             
            - test/command/test_plugin_config_formatter.rb
         
     | 
| 
       750 
775 
     | 
    
         
             
            - test/command/test_plugin_generator.rb
         
     | 
| 
         @@ -921,6 +946,7 @@ files: 
     | 
|
| 
       921 
946 
     | 
    
         
             
            - test/scripts/fluent/plugin/out_test.rb
         
     | 
| 
       922 
947 
     | 
    
         
             
            - test/scripts/fluent/plugin/out_test2.rb
         
     | 
| 
       923 
948 
     | 
    
         
             
            - test/scripts/fluent/plugin/parser_known.rb
         
     | 
| 
      
 949 
     | 
    
         
            +
            - test/test_capability.rb
         
     | 
| 
       924 
950 
     | 
    
         
             
            - test/test_clock.rb
         
     | 
| 
       925 
951 
     | 
    
         
             
            - test/test_config.rb
         
     | 
| 
       926 
952 
     | 
    
         
             
            - test/test_configdsl.rb
         
     | 
| 
         @@ -979,6 +1005,8 @@ summary: Fluentd event collector 
     | 
|
| 
       979 
1005 
     | 
    
         
             
            test_files:
         
     | 
| 
       980 
1006 
     | 
    
         
             
            - test/command/test_binlog_reader.rb
         
     | 
| 
       981 
1007 
     | 
    
         
             
            - test/command/test_ca_generate.rb
         
     | 
| 
      
 1008 
     | 
    
         
            +
            - test/command/test_cap_ctl.rb
         
     | 
| 
      
 1009 
     | 
    
         
            +
            - test/command/test_ctl.rb
         
     | 
| 
       982 
1010 
     | 
    
         
             
            - test/command/test_fluentd.rb
         
     | 
| 
       983 
1011 
     | 
    
         
             
            - test/command/test_plugin_config_formatter.rb
         
     | 
| 
       984 
1012 
     | 
    
         
             
            - test/command/test_plugin_generator.rb
         
     | 
| 
         @@ -1155,6 +1183,7 @@ test_files: 
     | 
|
| 
       1155 
1183 
     | 
    
         
             
            - test/scripts/fluent/plugin/out_test.rb
         
     | 
| 
       1156 
1184 
     | 
    
         
             
            - test/scripts/fluent/plugin/out_test2.rb
         
     | 
| 
       1157 
1185 
     | 
    
         
             
            - test/scripts/fluent/plugin/parser_known.rb
         
     | 
| 
      
 1186 
     | 
    
         
            +
            - test/test_capability.rb
         
     | 
| 
       1158 
1187 
     | 
    
         
             
            - test/test_clock.rb
         
     | 
| 
       1159 
1188 
     | 
    
         
             
            - test/test_config.rb
         
     | 
| 
       1160 
1189 
     | 
    
         
             
            - test/test_configdsl.rb
         
     |