fluentd 1.12.0-x86-mingw32 → 1.13.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/.deepsource.toml +13 -0
- data/.github/ISSUE_TEMPLATE/config.yml +2 -2
- data/.github/workflows/linux-test.yaml +36 -0
- data/.github/workflows/macos-test.yaml +30 -0
- data/.github/workflows/windows-test.yaml +46 -0
- data/.gitlab-ci.yml +41 -19
- data/CHANGELOG.md +164 -2
- data/CONTRIBUTING.md +2 -2
- data/MAINTAINERS.md +5 -2
- data/README.md +7 -4
- data/example/counter.conf +1 -1
- data/fluentd.gemspec +5 -4
- data/lib/fluent/command/bundler_injection.rb +1 -1
- data/lib/fluent/command/ca_generate.rb +6 -3
- data/lib/fluent/command/cat.rb +19 -4
- data/lib/fluent/command/fluentd.rb +5 -2
- data/lib/fluent/command/plugin_config_formatter.rb +16 -1
- data/lib/fluent/command/plugin_generator.rb +31 -1
- data/lib/fluent/compat/parser.rb +2 -2
- data/lib/fluent/config/section.rb +2 -2
- data/lib/fluent/config/types.rb +2 -2
- data/lib/fluent/event.rb +3 -13
- data/lib/fluent/load.rb +0 -1
- data/lib/fluent/log.rb +1 -0
- data/lib/fluent/plugin/file_wrapper.rb +49 -4
- data/lib/fluent/plugin/formatter_ltsv.rb +2 -2
- data/lib/fluent/plugin/in_http.rb +11 -1
- data/lib/fluent/plugin/in_monitor_agent.rb +1 -1
- data/lib/fluent/plugin/in_tail.rb +141 -41
- data/lib/fluent/plugin/in_tail/position_file.rb +15 -1
- data/lib/fluent/plugin/out_copy.rb +18 -5
- data/lib/fluent/plugin/out_exec_filter.rb +3 -3
- data/lib/fluent/plugin/out_forward.rb +74 -58
- data/lib/fluent/plugin/out_http.rb +9 -2
- data/lib/fluent/plugin/output.rb +11 -9
- data/lib/fluent/plugin/parser_csv.rb +2 -2
- data/lib/fluent/plugin/parser_syslog.rb +2 -2
- data/lib/fluent/plugin/storage_local.rb +4 -4
- data/lib/fluent/plugin_helper/server.rb +4 -2
- data/lib/fluent/plugin_helper/service_discovery.rb +39 -1
- data/lib/fluent/plugin_helper/service_discovery/manager.rb +11 -5
- data/lib/fluent/plugin_helper/socket_option.rb +2 -2
- data/lib/fluent/supervisor.rb +28 -5
- data/lib/fluent/system_config.rb +16 -1
- data/lib/fluent/time.rb +57 -1
- data/lib/fluent/version.rb +1 -1
- data/templates/new_gem/fluent-plugin.gemspec.erb +3 -3
- data/templates/plugin_config_formatter/param.md-table.erb +10 -0
- data/test/command/test_cat.rb +96 -0
- data/test/command/test_fluentd.rb +38 -0
- data/test/command/test_plugin_config_formatter.rb +67 -0
- data/test/config/test_configurable.rb +1 -1
- data/test/config/test_system_config.rb +46 -0
- data/test/plugin/in_tail/test_io_handler.rb +4 -4
- data/test/plugin/in_tail/test_position_file.rb +59 -5
- data/test/plugin/test_file_wrapper.rb +115 -0
- data/test/plugin/test_in_exec.rb +1 -1
- data/test/plugin/test_in_http.rb +15 -0
- data/test/plugin/test_in_tail.rb +309 -26
- data/test/plugin/test_out_copy.rb +87 -0
- data/test/plugin/test_out_forward.rb +104 -11
- data/test/plugin/test_out_http.rb +20 -1
- data/test/plugin/test_output.rb +15 -3
- data/test/plugin/test_output_as_buffered_backup.rb +2 -0
- data/test/plugin/test_parser_csv.rb +14 -0
- data/test/plugin/test_parser_syslog.rb +14 -0
- data/test/plugin/test_sd_file.rb +1 -1
- data/test/plugin_helper/service_discovery/test_manager.rb +1 -1
- data/test/plugin_helper/test_child_process.rb +5 -2
- data/test/plugin_helper/test_http_server_helper.rb +4 -2
- data/test/plugin_helper/test_server.rb +26 -7
- data/test/plugin_helper/test_service_discovery.rb +74 -14
- data/test/test_config.rb +2 -1
- data/test/test_event.rb +16 -0
- data/test/test_formatter.rb +30 -0
- data/test/test_output.rb +2 -2
- data/test/test_supervisor.rb +66 -0
- data/test/test_time_parser.rb +109 -0
- metadata +58 -31
- data/.travis.yml +0 -77
- data/appveyor.yml +0 -31
@@ -32,17 +32,23 @@ module Fluent
|
|
32
32
|
@static_config = true
|
33
33
|
end
|
34
34
|
|
35
|
-
def configure(
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
def configure(configs, parent: nil)
|
36
|
+
configs.each do |config|
|
37
|
+
type, conf = if config.has_key?(:conf) # for compatibility with initial API
|
38
|
+
[config[:type], config[:conf]]
|
39
|
+
else
|
40
|
+
[config['@type'], config]
|
41
|
+
end
|
42
|
+
|
43
|
+
sd = Fluent::Plugin.new_sd(type, parent: parent)
|
44
|
+
sd.configure(conf)
|
39
45
|
|
40
46
|
sd.services.each do |s|
|
41
47
|
@services[s.discovery_id] = build_service(s)
|
42
48
|
end
|
43
49
|
@discoveries << sd
|
44
50
|
|
45
|
-
if @static_config &&
|
51
|
+
if @static_config && type.to_sym != :static
|
46
52
|
@static_config = false
|
47
53
|
end
|
48
54
|
end
|
@@ -38,8 +38,8 @@ module Fluent
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
if send_keepalive_packet
|
41
|
-
if protocol != :tcp
|
42
|
-
raise ArgumentError, "BUG: send_keepalive_packet is available for tcp"
|
41
|
+
if protocol != :tcp && protocol != :tls
|
42
|
+
raise ArgumentError, "BUG: send_keepalive_packet is available for tcp/tls"
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
data/lib/fluent/supervisor.rb
CHANGED
@@ -45,6 +45,7 @@ module Fluent
|
|
45
45
|
module ServerModule
|
46
46
|
def before_run
|
47
47
|
@fluentd_conf = config[:fluentd_conf]
|
48
|
+
@rpc_endpoint = nil
|
48
49
|
@rpc_server = nil
|
49
50
|
@counter = nil
|
50
51
|
|
@@ -64,9 +65,13 @@ module Fluent
|
|
64
65
|
run_counter_server(counter)
|
65
66
|
end
|
66
67
|
|
67
|
-
|
68
|
-
|
69
|
-
|
68
|
+
if config[:disable_shared_socket]
|
69
|
+
$log.info "shared socket for multiple workers is disabled"
|
70
|
+
else
|
71
|
+
socket_manager_path = ServerEngine::SocketManager::Server.generate_path
|
72
|
+
ServerEngine::SocketManager::Server.open(socket_manager_path)
|
73
|
+
ENV['SERVERENGINE_SOCKETMANAGER_PATH'] = socket_manager_path.to_s
|
74
|
+
end
|
70
75
|
end
|
71
76
|
|
72
77
|
def after_run
|
@@ -380,7 +385,7 @@ module Fluent
|
|
380
385
|
config_mtime = File.mtime(path)
|
381
386
|
|
382
387
|
# reuse previous config if last load time is within 5 seconds and mtime of the config file is not changed
|
383
|
-
if Time.now - Time.at(pre_loadtime) < 5
|
388
|
+
if (Time.now - Time.at(pre_loadtime) < 5) && (config_mtime == pre_config_mtime)
|
384
389
|
return params['pre_conf']
|
385
390
|
end
|
386
391
|
|
@@ -452,6 +457,7 @@ module Fluent
|
|
452
457
|
config_path: path,
|
453
458
|
main_cmd: params['main_cmd'],
|
454
459
|
signame: params['signame'],
|
460
|
+
disable_shared_socket: params['disable_shared_socket']
|
455
461
|
}
|
456
462
|
if daemonize
|
457
463
|
se_config[:pid_path] = pid_path
|
@@ -512,6 +518,8 @@ module Fluent
|
|
512
518
|
dl_opts = {}
|
513
519
|
# subtract 1 to match serverengine daemon logger side logging severity.
|
514
520
|
dl_opts[:log_level] = @level - 1
|
521
|
+
dl_opts[:log_rotate_age] = @log_rotate_age if @log_rotate_age
|
522
|
+
dl_opts[:log_rotate_size] = @log_rotate_size if @log_rotate_size
|
515
523
|
logger = ServerEngine::DaemonLogger.new(@logdev, dl_opts)
|
516
524
|
$log = Fluent::Log.new(logger, @opts)
|
517
525
|
$log.enable_color(false) if @path
|
@@ -567,7 +575,8 @@ module Fluent
|
|
567
575
|
supervise: true,
|
568
576
|
standalone_worker: false,
|
569
577
|
signame: nil,
|
570
|
-
conf_encoding: 'utf-8'
|
578
|
+
conf_encoding: 'utf-8',
|
579
|
+
disable_shared_socket: nil
|
571
580
|
}
|
572
581
|
end
|
573
582
|
|
@@ -599,6 +608,19 @@ module Fluent
|
|
599
608
|
|
600
609
|
@cl_opt = opt
|
601
610
|
@conf = nil
|
611
|
+
# parse configuration immediately to initialize logger in early stage
|
612
|
+
if @config_path and File.exist?(@config_path)
|
613
|
+
@conf = Fluent::Config.build(config_path: @config_path,
|
614
|
+
encoding: @conf_encoding ? @conf_encoding : 'utf-8',
|
615
|
+
additional_config: @inline_config ? @inline_config : nil,
|
616
|
+
use_v1_config: !!@use_v1_config)
|
617
|
+
@system_config = build_system_config(@conf)
|
618
|
+
if @system_config.log
|
619
|
+
@log_rotate_age ||= @system_config.log.rotate_age
|
620
|
+
@log_rotate_size ||= @system_config.log.rotate_size
|
621
|
+
end
|
622
|
+
@conf = nil
|
623
|
+
end
|
602
624
|
|
603
625
|
log_opts = {suppress_repeated_stacktrace: opt[:suppress_repeated_stacktrace], ignore_repeated_log_interval: opt[:ignore_repeated_log_interval],
|
604
626
|
ignore_same_log_interval: opt[:ignore_same_log_interval]}
|
@@ -795,6 +817,7 @@ module Fluent
|
|
795
817
|
'counter_server' => @system_config.counter_server,
|
796
818
|
'log_format' => @system_config.log.format,
|
797
819
|
'log_time_format' => @system_config.log.time_format,
|
820
|
+
'disable_shared_socket' => @system_config.disable_shared_socket
|
798
821
|
}
|
799
822
|
|
800
823
|
se = ServerEngine.create(ServerModule, WorkerModule){
|
data/lib/fluent/system_config.rb
CHANGED
@@ -27,7 +27,7 @@ module Fluent
|
|
27
27
|
:log_event_verbose, :ignore_repeated_log_interval, :ignore_same_log_interval,
|
28
28
|
:without_source, :rpc_endpoint, :enable_get_dump, :process_name,
|
29
29
|
:file_permission, :dir_permission, :counter_server, :counter_client,
|
30
|
-
:strict_config_value, :enable_msgpack_time_support
|
30
|
+
:strict_config_value, :enable_msgpack_time_support, :disable_shared_socket
|
31
31
|
]
|
32
32
|
|
33
33
|
config_param :workers, :integer, default: 1
|
@@ -45,6 +45,7 @@ module Fluent
|
|
45
45
|
config_param :process_name, :string, default: nil
|
46
46
|
config_param :strict_config_value, :bool, default: nil
|
47
47
|
config_param :enable_msgpack_time_support, :bool, default: nil
|
48
|
+
config_param :disable_shared_socket, :bool, default: nil
|
48
49
|
config_param :file_permission, default: nil do |v|
|
49
50
|
v.to_i(8)
|
50
51
|
end
|
@@ -54,6 +55,20 @@ module Fluent
|
|
54
55
|
config_section :log, required: false, init: true, multi: false do
|
55
56
|
config_param :format, :enum, list: [:text, :json], default: :text
|
56
57
|
config_param :time_format, :string, default: '%Y-%m-%d %H:%M:%S %z'
|
58
|
+
config_param :rotate_age, default: nil do |v|
|
59
|
+
if Fluent::Log::LOG_ROTATE_AGE.include?(v)
|
60
|
+
v.to_sym
|
61
|
+
else
|
62
|
+
begin
|
63
|
+
Integer(v)
|
64
|
+
rescue ArgumentError => e
|
65
|
+
raise Fluent::ConfigError, e.message
|
66
|
+
else
|
67
|
+
v.to_i
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
config_param :rotate_size, :size, default: nil
|
57
72
|
end
|
58
73
|
|
59
74
|
config_section :counter_server, multi: false do
|
data/lib/fluent/time.rb
CHANGED
@@ -132,13 +132,14 @@ module Fluent
|
|
132
132
|
end
|
133
133
|
|
134
134
|
module TimeMixin
|
135
|
-
TIME_TYPES = ['string', 'unixtime', 'float']
|
135
|
+
TIME_TYPES = ['string', 'unixtime', 'float', 'mixed']
|
136
136
|
|
137
137
|
TIME_PARAMETERS = [
|
138
138
|
[:time_format, :string, {default: nil}],
|
139
139
|
[:localtime, :bool, {default: true}], # UTC if :localtime is false and :timezone is nil
|
140
140
|
[:utc, :bool, {default: false}], # to turn :localtime false
|
141
141
|
[:timezone, :string, {default: nil}],
|
142
|
+
[:time_format_fallbacks, :array, {default: []}], # try time_format, then try fallbacks
|
142
143
|
]
|
143
144
|
TIME_FULL_PARAMETERS = [
|
144
145
|
# To avoid to define :time_type twice (in plugin_helper/inject)
|
@@ -170,6 +171,12 @@ module Fluent
|
|
170
171
|
raise Fluent::ConfigError, "both of utc and localtime are specified, use only one of them"
|
171
172
|
end
|
172
173
|
|
174
|
+
if conf.has_key?('time_type') and @time_type == :mixed
|
175
|
+
if @time_format.nil? and @time_format_fallbacks.empty?
|
176
|
+
raise Fluent::ConfigError, "time_type is :mixed but time_format and time_format_fallbacks is empty."
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
173
180
|
Fluent::Timezone.validate!(@timezone) if @timezone
|
174
181
|
end
|
175
182
|
end
|
@@ -180,6 +187,7 @@ module Fluent
|
|
180
187
|
end
|
181
188
|
|
182
189
|
def time_parser_create(type: @time_type, format: @time_format, timezone: @timezone, force_localtime: false)
|
190
|
+
return MixedTimeParser.new(type, format, @localtime, timezone, @utc, force_localtime, @time_format_fallbacks) if type == :mixed
|
183
191
|
return NumericTimeParser.new(type) if type != :string
|
184
192
|
return TimeParser.new(format, true, nil) if force_localtime
|
185
193
|
|
@@ -452,4 +460,52 @@ module Fluent
|
|
452
460
|
end
|
453
461
|
end
|
454
462
|
end
|
463
|
+
|
464
|
+
# MixedTimeParser is available when time_type is set to :mixed
|
465
|
+
#
|
466
|
+
# Use Case 1: primary format is specified explicitly in time_format
|
467
|
+
# time_type mixed
|
468
|
+
# time_format %iso8601
|
469
|
+
# time_format_fallbacks unixtime
|
470
|
+
# Use Case 2: time_format is omitted
|
471
|
+
# time_type mixed
|
472
|
+
# time_format_fallbacks %iso8601, unixtime
|
473
|
+
#
|
474
|
+
class MixedTimeParser < TimeParser # to include TimeParseError
|
475
|
+
def initialize(type, format = nil, localtime = nil, timezone = nil, utc = nil, force_localtime = nil, fallbacks = [])
|
476
|
+
@parsers = []
|
477
|
+
fallbacks.unshift(format).each do |fallback|
|
478
|
+
next unless fallback
|
479
|
+
case fallback
|
480
|
+
when 'unixtime', 'float'
|
481
|
+
@parsers << NumericTimeParser.new(fallback, localtime, timezone)
|
482
|
+
else
|
483
|
+
if force_localtime
|
484
|
+
@parsers << TimeParser.new(fallback, true, nil)
|
485
|
+
else
|
486
|
+
localtime = localtime && (timezone.nil? && !utc)
|
487
|
+
@parsers << TimeParser.new(fallback, localtime, timezone)
|
488
|
+
end
|
489
|
+
end
|
490
|
+
end
|
491
|
+
end
|
492
|
+
|
493
|
+
def parse(value)
|
494
|
+
@parsers.each do |parser|
|
495
|
+
begin
|
496
|
+
Float(value) if parser.class == Fluent::NumericTimeParser
|
497
|
+
rescue
|
498
|
+
next
|
499
|
+
end
|
500
|
+
begin
|
501
|
+
return parser.parse(value)
|
502
|
+
rescue
|
503
|
+
# skip TimeParseError
|
504
|
+
end
|
505
|
+
end
|
506
|
+
fallback_class = @parsers.collect do |parser| parser.class end.join(",")
|
507
|
+
raise TimeParseError, "invalid time format: value = #{value}, even though fallbacks: #{fallback_class}"
|
508
|
+
end
|
509
|
+
end
|
510
|
+
|
455
511
|
end
|
data/lib/fluent/version.rb
CHANGED
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.test_files = test_files
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_development_dependency "bundler", "~>
|
24
|
-
spec.add_development_dependency "rake", "~>
|
25
|
-
spec.add_development_dependency "test-unit", "~>
|
23
|
+
spec.add_development_dependency "bundler", "~> <%= bundler_version %>"
|
24
|
+
spec.add_development_dependency "rake", "~> <%= rake_version %>"
|
25
|
+
spec.add_development_dependency "test-unit", "~> <%= test_unit_version %>"
|
26
26
|
spec.add_runtime_dependency "fluentd", [">= 0.14.10", "< 2"]
|
27
27
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<%-
|
2
|
+
type = config[:type]
|
3
|
+
required_label = config[:required] ? "required" : "optional"
|
4
|
+
default = config[:default]
|
5
|
+
alias_name = config[:alias]
|
6
|
+
deprecated = config[:deprecated]
|
7
|
+
obsoleted = config[:obsoleted]
|
8
|
+
description = config[:desc]
|
9
|
+
-%>
|
10
|
+
|<%= name %>|<%= type %> (<%= required_label %>)|<%= description %><%- if type == :enum -%> (<%= config[:list].map{|x| "`#{x}`"}.join(", ") %>)<%- end -%><%- if alias_name -%><br>Alias: <%= alias_name %><%- end -%><%- if deprecated -%><br>Deprecated: <%= deprecated %><%- end -%><%- if obsoleted -%><br>Obsoleted: <%= :obsoleted %><%- end -%>|<%- if default -%>`<%= default %>`<%- end -%>|
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require_relative '../helper'
|
2
|
+
|
3
|
+
require 'test-unit'
|
4
|
+
require 'open3'
|
5
|
+
require 'fluent/plugin/output'
|
6
|
+
require 'fluent/plugin/in_forward'
|
7
|
+
require 'fluent/plugin/out_secondary_file'
|
8
|
+
require 'fluent/test/driver/output'
|
9
|
+
require 'fluent/test/driver/input'
|
10
|
+
|
11
|
+
class TestFluentCat < ::Test::Unit::TestCase
|
12
|
+
def setup
|
13
|
+
Fluent::Test.setup
|
14
|
+
FileUtils.mkdir_p(TMP_DIR)
|
15
|
+
@record = { 'key' => 'value' }
|
16
|
+
@time = event_time
|
17
|
+
@es = Fluent::OneEventStream.new(@time, @record)
|
18
|
+
@primary = create_primary
|
19
|
+
metadata = @primary.buffer.new_metadata
|
20
|
+
@chunk = create_chunk(@primary, metadata, @es)
|
21
|
+
end
|
22
|
+
|
23
|
+
def teardown
|
24
|
+
FileUtils.rm_rf(TMP_DIR)
|
25
|
+
end
|
26
|
+
|
27
|
+
TMP_DIR = File.expand_path(File.dirname(__FILE__) + "/../tmp/command/fluent_cat#{ENV['TEST_ENV_NUMBER']}")
|
28
|
+
FLUENT_CAT_COMMAND = File.expand_path(File.dirname(__FILE__) + "/../../bin/fluent-cat")
|
29
|
+
|
30
|
+
PORT = unused_port
|
31
|
+
CONFIG = %[
|
32
|
+
port #{PORT}
|
33
|
+
bind 127.0.0.1
|
34
|
+
]
|
35
|
+
|
36
|
+
SECONDARY_CONFIG = %[
|
37
|
+
directory #{TMP_DIR}
|
38
|
+
]
|
39
|
+
|
40
|
+
class DummyOutput < Fluent::Plugin::Output
|
41
|
+
def write(chunk); end
|
42
|
+
end
|
43
|
+
|
44
|
+
def create_driver(conf=CONFIG)
|
45
|
+
Fluent::Test::Driver::Input.new(Fluent::Plugin::ForwardInput).configure(conf)
|
46
|
+
end
|
47
|
+
|
48
|
+
def create_primary(buffer_cofig = config_element('buffer'))
|
49
|
+
DummyOutput.new.configure(config_element('ROOT','',{}, [buffer_cofig]))
|
50
|
+
end
|
51
|
+
|
52
|
+
def create_secondary_driver(conf=SECONDARY_CONFIG)
|
53
|
+
c = Fluent::Test::Driver::Output.new(Fluent::Plugin::SecondaryFileOutput)
|
54
|
+
c.instance.acts_as_secondary(@primary)
|
55
|
+
c.configure(conf)
|
56
|
+
end
|
57
|
+
|
58
|
+
def create_chunk(primary, metadata, es)
|
59
|
+
primary.buffer.generate_chunk(metadata).tap do |c|
|
60
|
+
c.concat(es.to_msgpack_stream, es.size)
|
61
|
+
c.commit
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
sub_test_case "json" do
|
66
|
+
def test_cat_json
|
67
|
+
d = create_driver
|
68
|
+
d.run(expect_records: 1) do
|
69
|
+
Open3.pipeline_w("ruby #{FLUENT_CAT_COMMAND} --port #{PORT} json") do |stdin|
|
70
|
+
stdin.puts('{"key":"value"}')
|
71
|
+
stdin.close
|
72
|
+
end
|
73
|
+
end
|
74
|
+
event = d.events.first
|
75
|
+
assert_equal([1, "json", @record],
|
76
|
+
[d.events.size, event.first, event.last])
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
sub_test_case "msgpack" do
|
81
|
+
def test_cat_secondary_file
|
82
|
+
d = create_secondary_driver
|
83
|
+
path = d.instance.write(@chunk)
|
84
|
+
d = create_driver
|
85
|
+
d.run(expect_records: 1) do
|
86
|
+
Open3.pipeline_w("ruby #{FLUENT_CAT_COMMAND} --port #{PORT} --format msgpack secondary") do |stdin|
|
87
|
+
stdin.write(File.read(path))
|
88
|
+
stdin.close
|
89
|
+
end
|
90
|
+
end
|
91
|
+
event = d.events.first
|
92
|
+
assert_equal([1, "secondary", @record],
|
93
|
+
[d.events.size, event.first, event.last])
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -878,6 +878,8 @@ CONF
|
|
878
878
|
end
|
879
879
|
|
880
880
|
test "without RUBYOPT" do
|
881
|
+
saved_ruby_opt = ENV["RUBYOPT"]
|
882
|
+
ENV["RUBYOPT"] = nil
|
881
883
|
conf = <<CONF
|
882
884
|
<source>
|
883
885
|
@type dummy
|
@@ -889,6 +891,8 @@ CONF
|
|
889
891
|
CONF
|
890
892
|
conf_path = create_conf_file('rubyopt_test.conf', conf)
|
891
893
|
assert_log_matches(create_cmdline(conf_path), '-Eascii-8bit:ascii-8bit')
|
894
|
+
ensure
|
895
|
+
ENV["RUBYOPT"] = saved_ruby_opt
|
892
896
|
end
|
893
897
|
|
894
898
|
test 'invalid values are set to RUBYOPT' do
|
@@ -912,6 +916,8 @@ CONF
|
|
912
916
|
|
913
917
|
# https://github.com/fluent/fluentd/issues/2915
|
914
918
|
test "ruby path contains spaces" do
|
919
|
+
saved_ruby_opt = ENV["RUBYOPT"]
|
920
|
+
ENV["RUBYOPT"] = nil
|
915
921
|
conf = <<CONF
|
916
922
|
<source>
|
917
923
|
@type dummy
|
@@ -940,6 +946,8 @@ CONF
|
|
940
946
|
'spawn command to main:',
|
941
947
|
'-Eascii-8bit:ascii-8bit'
|
942
948
|
)
|
949
|
+
ensure
|
950
|
+
ENV["RUBYOPT"] = saved_ruby_opt
|
943
951
|
end
|
944
952
|
|
945
953
|
test 'success to start workers when file buffer is configured in non-workers way only for specific worker' do
|
@@ -1065,4 +1073,34 @@ CONF
|
|
1065
1073
|
"secret xxxxxx", patterns_not_match: ["secret secret0", "secret secret1"])
|
1066
1074
|
end
|
1067
1075
|
end
|
1076
|
+
|
1077
|
+
sub_test_case 'sahred socket options' do
|
1078
|
+
test 'enable shared socket by default' do
|
1079
|
+
conf = ""
|
1080
|
+
conf_path = create_conf_file('empty.conf', conf)
|
1081
|
+
assert File.exist?(conf_path)
|
1082
|
+
assert_log_matches(create_cmdline(conf_path),
|
1083
|
+
patterns_not_match: ["shared socket for multiple workers is disabled"])
|
1084
|
+
end
|
1085
|
+
|
1086
|
+
test 'disable shared socket by command line option' do
|
1087
|
+
conf = ""
|
1088
|
+
conf_path = create_conf_file('empty.conf', conf)
|
1089
|
+
assert File.exist?(conf_path)
|
1090
|
+
assert_log_matches(create_cmdline(conf_path, "--disable-shared-socket"),
|
1091
|
+
"shared socket for multiple workers is disabled",)
|
1092
|
+
end
|
1093
|
+
|
1094
|
+
test 'disable shared socket by system config' do
|
1095
|
+
conf = <<CONF
|
1096
|
+
<system>
|
1097
|
+
disable_shared_socket
|
1098
|
+
</system>
|
1099
|
+
CONF
|
1100
|
+
conf_path = create_conf_file('empty.conf', conf)
|
1101
|
+
assert File.exist?(conf_path)
|
1102
|
+
assert_log_matches(create_cmdline(conf_path, "--disable-shared-socket"),
|
1103
|
+
"shared socket for multiple workers is disabled",)
|
1104
|
+
end
|
1105
|
+
end
|
1068
1106
|
end
|