fluentd 0.14.0 → 0.14.1
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/example/copy_roundrobin.conf +39 -0
- data/example/filter_stdout.conf +5 -5
- data/example/in_forward.conf +2 -2
- data/example/in_http.conf +2 -2
- data/example/in_syslog.conf +2 -2
- data/example/in_tail.conf +2 -2
- data/example/in_tcp.conf +2 -2
- data/example/in_udp.conf +2 -2
- data/example/out_buffered_null.conf +32 -0
- data/example/out_copy.conf +4 -4
- data/example/out_file.conf +2 -2
- data/example/out_forward.conf +2 -2
- data/example/v0_12_filter.conf +8 -8
- data/fluentd.gemspec +1 -1
- data/lib/fluent/command/fluentd.rb +6 -1
- data/lib/fluent/compat/handle_tag_name_mixin.rb +53 -0
- data/lib/fluent/compat/input.rb +1 -0
- data/lib/fluent/compat/output.rb +1 -0
- data/lib/fluent/compat/record_filter_mixin.rb +34 -0
- data/lib/fluent/compat/set_tag_key_mixin.rb +50 -0
- data/lib/fluent/compat/set_time_key_mixin.rb +69 -0
- data/lib/fluent/compat/type_converter.rb +90 -0
- data/lib/fluent/config/configure_proxy.rb +24 -4
- data/lib/fluent/config/dsl.rb +18 -1
- data/lib/fluent/config/v1_parser.rb +3 -2
- data/lib/fluent/configurable.rb +1 -1
- data/lib/fluent/event.rb +37 -9
- data/lib/fluent/mixin.rb +12 -286
- data/lib/fluent/plugin/buffer.rb +2 -2
- data/lib/fluent/plugin/in_dummy.rb +5 -1
- data/lib/fluent/plugin/in_gc_stat.rb +7 -37
- data/lib/fluent/plugin/in_http.rb +2 -0
- data/lib/fluent/plugin/{in_stream.rb → in_unix.rb} +0 -0
- data/lib/fluent/plugin/out_buffered_stdout.rb +60 -0
- data/lib/fluent/plugin/out_copy.rb +8 -51
- data/lib/fluent/plugin/out_null.rb +5 -5
- data/lib/fluent/plugin/out_relabel.rb +5 -5
- data/lib/fluent/plugin/out_roundrobin.rb +13 -40
- data/lib/fluent/plugin/output.rb +9 -0
- data/lib/fluent/plugin_helper.rb +2 -0
- data/lib/fluent/plugin_helper/formatter.rb +138 -0
- data/lib/fluent/plugin_helper/inject.rb +112 -0
- data/lib/fluent/plugin_helper/parser.rb +138 -0
- data/lib/fluent/plugin_helper/storage.rb +64 -50
- data/lib/fluent/process.rb +6 -1
- data/lib/fluent/registry.rb +1 -1
- data/lib/fluent/supervisor.rb +20 -2
- data/lib/fluent/test.rb +30 -5
- data/lib/fluent/test/base.rb +2 -66
- data/lib/fluent/test/driver/base.rb +3 -0
- data/lib/fluent/test/driver/base_owned.rb +106 -0
- data/lib/fluent/test/driver/formatter.rb +30 -0
- data/lib/fluent/test/driver/multi_output.rb +52 -0
- data/lib/fluent/test/driver/owner.rb +32 -0
- data/lib/fluent/test/driver/parser.rb +30 -0
- data/lib/fluent/test/helpers.rb +54 -0
- data/lib/fluent/test/log.rb +73 -0
- data/lib/fluent/time.rb +71 -0
- data/lib/fluent/version.rb +1 -1
- data/test/compat/test_parser.rb +82 -0
- data/test/config/test_configure_proxy.rb +15 -0
- data/test/config/test_dsl.rb +180 -2
- data/test/helper.rb +2 -24
- data/test/plugin/test_in_gc_stat.rb +6 -6
- data/test/plugin/test_in_http.rb +49 -32
- data/test/plugin/{test_in_stream.rb → test_in_unix.rb} +1 -1
- data/test/plugin/test_out_buffered_stdout.rb +108 -0
- data/test/plugin/test_out_copy.rb +88 -127
- data/test/plugin/test_out_null.rb +29 -0
- data/test/plugin/test_out_relabel.rb +28 -0
- data/test/plugin/test_out_roundrobin.rb +35 -29
- data/test/plugin/test_out_stdout.rb +4 -4
- data/test/plugin/test_output_as_buffered.rb +51 -0
- data/test/plugin/test_output_as_buffered_secondary.rb +13 -0
- data/test/plugin/test_parser_apache.rb +38 -0
- data/test/plugin/test_parser_apache2.rb +38 -0
- data/test/plugin/test_parser_apache_error.rb +40 -0
- data/test/plugin/test_parser_base.rb +32 -0
- data/test/plugin/test_parser_csv.rb +94 -0
- data/test/plugin/test_parser_json.rb +107 -0
- data/test/plugin/test_parser_labeled_tsv.rb +129 -0
- data/test/plugin/test_parser_multiline.rb +100 -0
- data/test/plugin/test_parser_nginx.rb +42 -0
- data/test/plugin/test_parser_none.rb +53 -0
- data/test/plugin/test_parser_regexp.rb +110 -0
- data/test/plugin/test_parser_syslog.rb +66 -0
- data/test/plugin/test_parser_time.rb +46 -0
- data/test/plugin/test_parser_tsv.rb +125 -0
- data/test/plugin_helper/test_child_process.rb +11 -2
- data/test/plugin_helper/test_formatter.rb +212 -0
- data/test/plugin_helper/test_inject.rb +388 -0
- data/test/plugin_helper/test_parser.rb +223 -0
- data/test/plugin_helper/test_retry_state.rb +40 -40
- data/test/plugin_helper/test_storage.rb +77 -10
- data/test/scripts/fluent/plugin/out_test.rb +22 -17
- data/test/scripts/fluent/plugin/out_test2.rb +80 -0
- data/test/test_event.rb +57 -0
- data/test/test_formatter.rb +0 -178
- data/test/test_output.rb +2 -152
- data/test/test_root_agent.rb +3 -2
- data/test/test_supervisor.rb +93 -26
- data/test/test_time_formatter.rb +186 -0
- metadata +69 -7
- data/test/test_parser.rb +0 -1087
data/lib/fluent/process.rb
CHANGED
@@ -14,10 +14,15 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
+
# This feature will be deprecated after introducing
|
18
|
+
# symmetric multi processing in core.
|
19
|
+
|
17
20
|
require 'thread'
|
18
21
|
|
19
22
|
require 'fluent/config'
|
20
|
-
|
23
|
+
## This comment out (to remove circular reference) is a bit risky,
|
24
|
+
## but in all known cases this file is required after 'fluent/engine'.
|
25
|
+
# require 'fluent/engine'
|
21
26
|
require 'fluent/event'
|
22
27
|
|
23
28
|
module Fluent
|
data/lib/fluent/registry.rb
CHANGED
data/lib/fluent/supervisor.rb
CHANGED
@@ -201,7 +201,9 @@ module Fluent
|
|
201
201
|
logger_initializer.init
|
202
202
|
logger = $log
|
203
203
|
|
204
|
-
daemonize
|
204
|
+
# ServerEngine's "daemonize" option is boolean, and path of pid file is brought by "pid_path"
|
205
|
+
pid_path = params['daemonize']
|
206
|
+
daemonize = !!params['daemonize']
|
205
207
|
main_cmd = params['main_cmd']
|
206
208
|
|
207
209
|
se_config = {
|
@@ -232,6 +234,9 @@ module Fluent
|
|
232
234
|
fluentd_conf: fluentd_conf,
|
233
235
|
main_cmd: main_cmd,
|
234
236
|
}
|
237
|
+
if daemonize
|
238
|
+
se_config[:pid_path] = pid_path
|
239
|
+
end
|
235
240
|
pre_params = params.dup
|
236
241
|
params['pre_loadtime'] = Time.now.to_i
|
237
242
|
params['pre_config_mtime'] = config_mtime
|
@@ -306,6 +311,7 @@ module Fluent
|
|
306
311
|
without_source: false,
|
307
312
|
use_v1_config: true,
|
308
313
|
supervise: true,
|
314
|
+
standalone_worker: false,
|
309
315
|
signame: nil,
|
310
316
|
winsvcreg: nil,
|
311
317
|
}
|
@@ -314,6 +320,7 @@ module Fluent
|
|
314
320
|
def initialize(opt)
|
315
321
|
@daemonize = opt[:daemonize]
|
316
322
|
@supervise = opt[:supervise]
|
323
|
+
@standalone_worker= opt[:standalone_worker]
|
317
324
|
@config_path = opt[:config_path]
|
318
325
|
@inline_config = opt[:inline_config]
|
319
326
|
@use_v1_config = opt[:use_v1_config]
|
@@ -376,6 +383,7 @@ module Fluent
|
|
376
383
|
$log.info "starting fluentd-#{Fluent::VERSION} without supervision"
|
377
384
|
|
378
385
|
main_process do
|
386
|
+
create_socket_manager if @standalone_worker
|
379
387
|
change_privilege
|
380
388
|
init_engine
|
381
389
|
run_configure
|
@@ -386,6 +394,12 @@ module Fluent
|
|
386
394
|
|
387
395
|
private
|
388
396
|
|
397
|
+
def create_socket_manager
|
398
|
+
socket_manager_path = ServerEngine::SocketManager::Server.generate_path
|
399
|
+
ServerEngine::SocketManager::Server.open(socket_manager_path)
|
400
|
+
ENV['SERVERENGINE_SOCKETMANAGER_PATH'] = socket_manager_path.to_s
|
401
|
+
end
|
402
|
+
|
389
403
|
def dry_run
|
390
404
|
$log.info "starting fluentd-#{Fluent::VERSION} as dry run mode"
|
391
405
|
change_privilege
|
@@ -425,21 +439,25 @@ module Fluent
|
|
425
439
|
def supervise
|
426
440
|
$log.info "starting fluentd-#{Fluent::VERSION}"
|
427
441
|
|
442
|
+
rubyopt = ENV["RUBYOPT"]
|
428
443
|
if Fluent.windows?
|
444
|
+
# Shellwords doesn't work on windows, then used gsub for adapting space char instead of Shellwords
|
429
445
|
fluentd_spawn_cmd = ServerEngine.ruby_bin_path + " -Eascii-8bit:ascii-8bit "
|
446
|
+
fluentd_spawn_cmd << ' "' + rubyopt.gsub('"', '""') + '" ' if rubyopt
|
430
447
|
fluentd_spawn_cmd << ' "' + $0.gsub('"', '""') + '" '
|
431
448
|
$fluentdargv.each{|a|
|
432
449
|
fluentd_spawn_cmd << ('"' + a.gsub('"', '""') + '" ')
|
433
450
|
}
|
434
451
|
else
|
435
452
|
fluentd_spawn_cmd = ServerEngine.ruby_bin_path + " -Eascii-8bit:ascii-8bit "
|
453
|
+
fluentd_spawn_cmd << ' ' + rubyopt + ' ' if rubyopt
|
436
454
|
fluentd_spawn_cmd << $0.shellescape + ' '
|
437
455
|
$fluentdargv.each{|a|
|
438
456
|
fluentd_spawn_cmd << (a.shellescape + " ")
|
439
457
|
}
|
440
458
|
end
|
441
459
|
|
442
|
-
fluentd_spawn_cmd << ("--
|
460
|
+
fluentd_spawn_cmd << ("--under-supervisor")
|
443
461
|
$log.info "spawn command to main: " + fluentd_spawn_cmd
|
444
462
|
|
445
463
|
params = {}
|
data/lib/fluent/test.rb
CHANGED
@@ -16,6 +16,7 @@
|
|
16
16
|
|
17
17
|
require 'test/unit'
|
18
18
|
require 'fluent/env' # for Fluent.windows?
|
19
|
+
require 'fluent/test/log'
|
19
20
|
require 'fluent/test/base'
|
20
21
|
require 'fluent/test/input_test'
|
21
22
|
require 'fluent/test/output_test'
|
@@ -24,8 +25,32 @@ require 'fluent/test/parser_test'
|
|
24
25
|
require 'fluent/test/formatter_test'
|
25
26
|
require 'serverengine'
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
|
29
|
+
module Fluent
|
30
|
+
module Test
|
31
|
+
def self.dummy_logger
|
32
|
+
dl_opts = {log_level: ServerEngine::DaemonLogger::INFO}
|
33
|
+
logdev = Fluent::Test::DummyLogDevice.new
|
34
|
+
logger = ServerEngine::DaemonLogger.new(logdev, dl_opts)
|
35
|
+
Fluent::Log.new(logger)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.setup
|
39
|
+
$log = dummy_logger
|
40
|
+
|
41
|
+
Fluent.__send__(:remove_const, :Engine)
|
42
|
+
engine = Fluent.const_set(:Engine, EngineClass.new).init(SystemConfig.new)
|
43
|
+
|
44
|
+
engine.define_singleton_method(:now=) {|n|
|
45
|
+
@now = n
|
46
|
+
}
|
47
|
+
engine.define_singleton_method(:now) {
|
48
|
+
@now ||= super()
|
49
|
+
}
|
50
|
+
|
51
|
+
nil
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
$log ||= Fluent::Test.dummy_logger
|
data/lib/fluent/test/base.rb
CHANGED
@@ -14,27 +14,14 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
+
require 'fluent/config'
|
17
18
|
require 'fluent/engine'
|
18
19
|
require 'fluent/system_config'
|
19
|
-
require 'fluent/
|
20
|
+
require 'fluent/test/log'
|
20
21
|
require 'serverengine'
|
21
22
|
|
22
23
|
module Fluent
|
23
24
|
module Test
|
24
|
-
def self.setup
|
25
|
-
Fluent.__send__(:remove_const, :Engine)
|
26
|
-
engine = Fluent.const_set(:Engine, EngineClass.new).init(SystemConfig.new)
|
27
|
-
|
28
|
-
engine.define_singleton_method(:now=) {|n|
|
29
|
-
@now = n
|
30
|
-
}
|
31
|
-
engine.define_singleton_method(:now) {
|
32
|
-
@now ||= super()
|
33
|
-
}
|
34
|
-
|
35
|
-
nil
|
36
|
-
end
|
37
|
-
|
38
25
|
class TestDriver
|
39
26
|
include ::Test::Unit::Assertions
|
40
27
|
|
@@ -84,57 +71,6 @@ module Fluent
|
|
84
71
|
end
|
85
72
|
end
|
86
73
|
end
|
87
|
-
|
88
|
-
class DummyLogDevice
|
89
|
-
attr_reader :logs
|
90
|
-
|
91
|
-
def initialize
|
92
|
-
@logs = []
|
93
|
-
end
|
94
|
-
|
95
|
-
def reset
|
96
|
-
@logs = []
|
97
|
-
end
|
98
|
-
|
99
|
-
def tty?
|
100
|
-
false
|
101
|
-
end
|
102
|
-
|
103
|
-
def puts(*args)
|
104
|
-
args.each{ |arg| write(arg + "\n") }
|
105
|
-
end
|
106
|
-
|
107
|
-
def write(message)
|
108
|
-
@logs.push message
|
109
|
-
end
|
110
|
-
|
111
|
-
def flush
|
112
|
-
true
|
113
|
-
end
|
114
|
-
|
115
|
-
def close
|
116
|
-
true
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
class TestLogger < Fluent::PluginLogger
|
121
|
-
def initialize
|
122
|
-
@logdev = DummyLogDevice.new
|
123
|
-
dl_opts = {}
|
124
|
-
dl_opts[:log_level] = ServerEngine::DaemonLogger::INFO
|
125
|
-
logger = ServerEngine::DaemonLogger.new(@logdev, dl_opts)
|
126
|
-
log = Fluent::Log.new(logger)
|
127
|
-
super(log)
|
128
|
-
end
|
129
|
-
|
130
|
-
def reset
|
131
|
-
@logdev.reset
|
132
|
-
end
|
133
|
-
|
134
|
-
def logs
|
135
|
-
@logdev.logs
|
136
|
-
end
|
137
|
-
end
|
138
74
|
end
|
139
75
|
end
|
140
76
|
|
@@ -14,6 +14,8 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
+
require 'fluent/config/element'
|
18
|
+
require 'fluent/log'
|
17
19
|
require 'fluent/test/driver/test_event_router'
|
18
20
|
|
19
21
|
require 'timeout'
|
@@ -104,6 +106,7 @@ module Fluent
|
|
104
106
|
end
|
105
107
|
|
106
108
|
def events(tag: nil)
|
109
|
+
return [] if @event_streams.nil?
|
107
110
|
selected = @event_streams.select{|e| tag.nil? ? true : e.tag == tag }
|
108
111
|
if block_given?
|
109
112
|
selected.each do |e|
|
@@ -0,0 +1,106 @@
|
|
1
|
+
#
|
2
|
+
# Fluentd
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'fluent/config'
|
18
|
+
require 'fluent/config/element'
|
19
|
+
require 'fluent/log'
|
20
|
+
require 'fluent/test/driver/owner'
|
21
|
+
|
22
|
+
module Fluent
|
23
|
+
module Test
|
24
|
+
module Driver
|
25
|
+
class BaseOwned
|
26
|
+
def initialize(klass, opts: {}, &block)
|
27
|
+
if klass.is_a?(Class)
|
28
|
+
if block
|
29
|
+
# Create new class for test w/ overwritten methods
|
30
|
+
# klass.dup is worse because its ancestors does NOT include original class name
|
31
|
+
klass = Class.new(klass)
|
32
|
+
klass.module_eval(&block)
|
33
|
+
end
|
34
|
+
@instance = klass.new
|
35
|
+
else
|
36
|
+
@instance = klass
|
37
|
+
end
|
38
|
+
owner = Fluent::Test::Driver::Owner.new
|
39
|
+
if opts
|
40
|
+
owner.system_config_override(opts)
|
41
|
+
end
|
42
|
+
owner.log = TestLogger.new
|
43
|
+
|
44
|
+
if @instance.respond_to?(:owner=)
|
45
|
+
@instance.owner = owner
|
46
|
+
if opts
|
47
|
+
@instance.system_config_override(opts)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
@logs = owner.log.out.logs
|
52
|
+
@section_name = ''
|
53
|
+
end
|
54
|
+
|
55
|
+
attr_reader :instance, :logs
|
56
|
+
|
57
|
+
def configure(conf, syntax: :v1)
|
58
|
+
if conf.is_a?(Fluent::Config::Element)
|
59
|
+
@config = conf
|
60
|
+
elsif conf.is_a?(Hash)
|
61
|
+
@config = Fluent::Config::Element.new(@section_name, "", Hash[conf.map{|k,v| [k.to_s, v]}], [])
|
62
|
+
else
|
63
|
+
@config = Fluent::Config.parse(conf, @section_name, "", syntax: syntax)
|
64
|
+
end
|
65
|
+
@instance.configure(@config)
|
66
|
+
self
|
67
|
+
end
|
68
|
+
|
69
|
+
def run(start: true, shutdown: true, &block)
|
70
|
+
instance_start if start
|
71
|
+
|
72
|
+
begin
|
73
|
+
yield
|
74
|
+
ensure
|
75
|
+
instance_shutdown if shutdown
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def instance_start
|
80
|
+
unless @instance.started?
|
81
|
+
@instance.start
|
82
|
+
instance_hook_after_started
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def instance_hook_after_started
|
87
|
+
# insert hooks for tests available after instance.start
|
88
|
+
end
|
89
|
+
|
90
|
+
def instance_shutdown
|
91
|
+
@instance.stop unless @instance.stopped?
|
92
|
+
@instance.before_shutdown unless @instance.before_shutdown?
|
93
|
+
@instance.shutdown unless @instance.shutdown?
|
94
|
+
|
95
|
+
if @instance.respond_to?(:event_loop_wait_until_stop)
|
96
|
+
@instance.event_loop_wait_until_stop
|
97
|
+
end
|
98
|
+
|
99
|
+
@instance.after_shutdown unless @instance.after_shutdown?
|
100
|
+
@instance.close unless @instance.closed?
|
101
|
+
@instance.terminate unless @instance.terminated?
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#
|
2
|
+
# Fluentd
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'fluent/test/driver/base_owned'
|
18
|
+
|
19
|
+
module Fluent
|
20
|
+
module Test
|
21
|
+
module Driver
|
22
|
+
class Formatter < BaseOwned
|
23
|
+
def initialize(klass, **kwargs, &block)
|
24
|
+
super
|
25
|
+
@section_name = "format"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#
|
2
|
+
# Fluentd
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'fluent/test/driver/base'
|
18
|
+
require 'fluent/test/driver/event_feeder'
|
19
|
+
|
20
|
+
require 'fluent/plugin/multi_output'
|
21
|
+
|
22
|
+
module Fluent
|
23
|
+
module Test
|
24
|
+
module Driver
|
25
|
+
class MultiOutput < Base
|
26
|
+
include EventFeeder
|
27
|
+
|
28
|
+
def initialize(klass, opts: {}, &block)
|
29
|
+
super
|
30
|
+
raise ArgumentError, "plugin is not an instance of Fluent::Plugin::MultiOutput" unless @instance.is_a? Fluent::Plugin::MultiOutput
|
31
|
+
@flush_buffer_at_cleanup = nil
|
32
|
+
end
|
33
|
+
|
34
|
+
def run(flush: true, **kwargs, &block)
|
35
|
+
@flush_buffer_at_cleanup = flush
|
36
|
+
super(**kwargs, &block)
|
37
|
+
end
|
38
|
+
|
39
|
+
def run_actual(**kwargs, &block)
|
40
|
+
super(**kwargs, &block)
|
41
|
+
if @flush_buffer_at_cleanup
|
42
|
+
@instance.outputs.each{|o| o.force_flush }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def flush
|
47
|
+
@instance.outputs.each{|o| o.force_flush }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|