fluentd 1.17.1 → 1.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +58 -4
- data/lib/fluent/command/fluentd.rb +7 -1
- data/lib/fluent/config/literal_parser.rb +9 -2
- data/lib/fluent/engine.rb +49 -33
- data/lib/fluent/env.rb +3 -0
- data/lib/fluent/event_router.rb +2 -2
- data/lib/fluent/plugin/filter_parser.rb +27 -51
- data/lib/fluent/plugin/in_http.rb +5 -0
- data/lib/fluent/plugin/in_syslog.rb +4 -0
- data/lib/fluent/plugin/in_tcp.rb +4 -0
- data/lib/fluent/plugin/in_udp.rb +10 -1
- data/lib/fluent/plugin/input.rb +4 -0
- data/lib/fluent/plugin/out_buffer.rb +40 -0
- data/lib/fluent/plugin/output.rb +2 -0
- data/lib/fluent/plugin_helper/cert_option.rb +8 -0
- data/lib/fluent/plugin_helper/event_emitter.rb +12 -0
- data/lib/fluent/plugin_helper/http_server/server.rb +23 -7
- data/lib/fluent/plugin_helper/server.rb +9 -0
- data/lib/fluent/root_agent.rb +114 -19
- data/lib/fluent/source_only_buffer_agent.rb +102 -0
- data/lib/fluent/supervisor.rb +207 -34
- data/lib/fluent/system_config.rb +15 -3
- data/lib/fluent/version.rb +1 -1
- metadata +7 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a1989dbb2f29908c7e3b04e7cbc99ef04f982becf62a572b043a2600983af75
|
4
|
+
data.tar.gz: b0a4fbfe760f1e6cab76a6d10576d96ff0f5e6c872b5ad870fbc156629a81166
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8ce0b4a097d2f200b13c38bfb8c0d0747d9cdaf74cc70419467e21011d7bfc12e6651f7a0cc3f381565de22d1f13d063470371e024e7a5ec404456cd9a7e270
|
7
|
+
data.tar.gz: af53ab2d7a880ca70f0f86cc7d640e45aad815509c1fa91e9dbd9d09a100818adad0f8de003fd853d08e663dc2dcbc951f9ef9da43ddc4705a569afbb2cc374a
|
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,63 @@
|
|
1
|
+
# v1.18
|
2
|
+
|
3
|
+
## Release v1.18.0 - 2024/11/29
|
4
|
+
|
5
|
+
### Enhancement
|
6
|
+
|
7
|
+
* Add zero-downtime-restart feature for non-Windows
|
8
|
+
https://github.com/fluent/fluentd/pull/4624
|
9
|
+
* Add with-source-only feature
|
10
|
+
https://github.com/fluent/fluentd/pull/4661
|
11
|
+
* `fluentd` command: Add `--with-source-only` option
|
12
|
+
* System configuration: Add `with_source_only` option
|
13
|
+
* Embedded plugin: Add `out_buffer` plugin, which can be used for buffering and relabeling events
|
14
|
+
https://github.com/fluent/fluentd/pull/4661
|
15
|
+
* Config File Syntax: Extend Embedded Ruby Code support for Hashes and Arrays
|
16
|
+
https://github.com/fluent/fluentd/pull/4580
|
17
|
+
* Example: `key {"foo":"#{1 + 1}"} => key {"foo":"2"}`
|
18
|
+
* Please note that this is not backward compatible, although we assume that this will never affect to actual existing configs.
|
19
|
+
* In case the behavior changes unintentionally, you can disable this feature by surrounding the entire value with single quotes.
|
20
|
+
* `key '{"foo":"#{1 + 1}"}' => key {"foo":"#{1 + 1}"}`
|
21
|
+
* transport tls: Use SSL_VERIFY_NONE by default
|
22
|
+
https://github.com/fluent/fluentd/pull/4718
|
23
|
+
* transport tls: Add ensure_fips option to ensure FIPS compliant mode
|
24
|
+
https://github.com/fluent/fluentd/pull/4720
|
25
|
+
* plugin_helper/server: Add receive_buffer_size parameter in transport section
|
26
|
+
https://github.com/fluent/fluentd/pull/4649
|
27
|
+
* filter_parser: Now able to handle multiple parsed results
|
28
|
+
https://github.com/fluent/fluentd/pull/4620
|
29
|
+
* in_http: add `add_tag_prefix` option
|
30
|
+
https://github.com/fluent/fluentd/pull/4655
|
31
|
+
* System configuration: add `path` option in `log` section
|
32
|
+
https://github.com/fluent/fluentd/pull/4604
|
33
|
+
|
34
|
+
### Bug Fix
|
35
|
+
|
36
|
+
* command: fix NoMethodError of --daemon under Windows
|
37
|
+
https://github.com/fluent/fluentd/pull/4716
|
38
|
+
* `fluentd` command: fix `--plugin` (`-p`) option not to overwrite default value
|
39
|
+
https://github.com/fluent/fluentd/pull/4605
|
40
|
+
|
41
|
+
### Misc
|
42
|
+
|
43
|
+
* http_server: Ready to support Async 2.0 gem
|
44
|
+
https://github.com/fluent/fluentd/pull/4619
|
45
|
+
* Minor code refactoring
|
46
|
+
* https://github.com/fluent/fluentd/pull/4641
|
47
|
+
* CI fixes
|
48
|
+
* https://github.com/fluent/fluentd/pull/4638
|
49
|
+
* https://github.com/fluent/fluentd/pull/4644
|
50
|
+
* https://github.com/fluent/fluentd/pull/4675
|
51
|
+
* https://github.com/fluent/fluentd/pull/4676
|
52
|
+
* https://github.com/fluent/fluentd/pull/4677
|
53
|
+
* https://github.com/fluent/fluentd/pull/4686
|
54
|
+
|
1
55
|
# v1.17
|
2
56
|
|
3
57
|
## Release v1.17.1 - 2024/08/19
|
4
58
|
|
5
59
|
### Enhancement
|
6
60
|
|
7
|
-
* yaml_parser: Support $log_level element
|
8
|
-
https://github.com/fluent/fluentd/pull/4482
|
9
|
-
* out_file: Add warn message for symlink_path setting
|
10
|
-
https://github.com/fluent/fluentd/pull/4502
|
11
61
|
* out_http: Add `compress gzip` option
|
12
62
|
https://github.com/fluent/fluentd/pull/4528
|
13
63
|
* in_exec: Add `encoding` option to handle non-ascii characters
|
@@ -30,6 +80,8 @@
|
|
30
80
|
https://github.com/fluent/fluentd/pull/4522
|
31
81
|
* in_tail: Fix an issue where a large single line could consume a large amount of memory even though `max_line_size` is set
|
32
82
|
https://github.com/fluent/fluentd/pull/4530
|
83
|
+
* yaml_parser: Support $log_level element
|
84
|
+
https://github.com/fluent/fluentd/pull/4482
|
33
85
|
|
34
86
|
### Misc
|
35
87
|
|
@@ -45,6 +97,8 @@
|
|
45
97
|
https://github.com/fluent/fluentd/pull/4598
|
46
98
|
* Add logger gem dependency for Ruby 3.5
|
47
99
|
https://github.com/fluent/fluentd/pull/4589
|
100
|
+
* out_file: Add warn message for symlink_path setting
|
101
|
+
https://github.com/fluent/fluentd/pull/4502
|
48
102
|
|
49
103
|
## Release v1.17.0 - 2024/04/30
|
50
104
|
|
@@ -46,7 +46,7 @@ op.on('--show-plugin-config=PLUGIN', "[DEPRECATED] Show PLUGIN configuration and
|
|
46
46
|
}
|
47
47
|
|
48
48
|
op.on('-p', '--plugin DIR', "add plugin directory") {|s|
|
49
|
-
(cmd_opts[:plugin_dirs] ||= []) << s
|
49
|
+
(cmd_opts[:plugin_dirs] ||= default_opts[:plugin_dirs]) << s
|
50
50
|
}
|
51
51
|
|
52
52
|
op.on('-I PATH', "add library path") {|s|
|
@@ -127,6 +127,12 @@ op.on('--without-source', "invoke a fluentd without input plugins", TrueClass) {
|
|
127
127
|
cmd_opts[:without_source] = b
|
128
128
|
}
|
129
129
|
|
130
|
+
unless Fluent.windows?
|
131
|
+
op.on('--with-source-only', "Invoke a fluentd only with input plugins. The data is stored in a temporary buffer. Send SIGWINCH to cancel this mode and process the data (Not supported on Windows).", TrueClass) {|b|
|
132
|
+
cmd_opts[:with_source_only] = b
|
133
|
+
}
|
134
|
+
end
|
135
|
+
|
130
136
|
op.on('--config-file-type VALU', 'guessing file type of fluentd configuration. yaml/yml or guess') { |s|
|
131
137
|
if (s == 'yaml') || (s == 'yml')
|
132
138
|
cmd_opts[:config_file_type] = s.to_sym
|
@@ -254,8 +254,15 @@ EOM
|
|
254
254
|
buffer << line_buffer + "\n"
|
255
255
|
line_buffer = ""
|
256
256
|
else
|
257
|
-
|
258
|
-
|
257
|
+
if @ss.exist?(/^\{[^}]+\}/)
|
258
|
+
# if it's interpolated string
|
259
|
+
skip(/\{/)
|
260
|
+
line_buffer << eval_embedded_code(scan_embedded_code)
|
261
|
+
skip(/\}/)
|
262
|
+
else
|
263
|
+
# '#' is a char in json string
|
264
|
+
line_buffer << char
|
265
|
+
end
|
259
266
|
end
|
260
267
|
|
261
268
|
next # This char '#' MUST NOT terminate json object.
|
data/lib/fluent/engine.rb
CHANGED
@@ -43,13 +43,15 @@ module Fluent
|
|
43
43
|
@system_config = SystemConfig.new
|
44
44
|
|
45
45
|
@supervisor_mode = false
|
46
|
+
|
47
|
+
@root_agent_mutex = Mutex.new
|
46
48
|
end
|
47
49
|
|
48
50
|
MAINLOOP_SLEEP_INTERVAL = 0.3
|
49
51
|
|
50
52
|
attr_reader :root_agent, :system_config, :supervisor_mode
|
51
53
|
|
52
|
-
def init(system_config, supervisor_mode: false)
|
54
|
+
def init(system_config, supervisor_mode: false, start_in_parallel: false)
|
53
55
|
@system_config = system_config
|
54
56
|
@supervisor_mode = supervisor_mode
|
55
57
|
|
@@ -58,7 +60,7 @@ module Fluent
|
|
58
60
|
|
59
61
|
@log_event_verbose = system_config.log_event_verbose unless system_config.log_event_verbose.nil?
|
60
62
|
|
61
|
-
@root_agent = RootAgent.new(log: log, system_config: @system_config)
|
63
|
+
@root_agent = RootAgent.new(log: log, system_config: @system_config, start_in_parallel: start_in_parallel)
|
62
64
|
|
63
65
|
self
|
64
66
|
end
|
@@ -133,7 +135,15 @@ module Fluent
|
|
133
135
|
end
|
134
136
|
|
135
137
|
def flush!
|
136
|
-
@
|
138
|
+
@root_agent_mutex.synchronize do
|
139
|
+
@root_agent.flush!
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def cancel_source_only!
|
144
|
+
@root_agent_mutex.synchronize do
|
145
|
+
@root_agent.cancel_source_only!
|
146
|
+
end
|
137
147
|
end
|
138
148
|
|
139
149
|
def now
|
@@ -144,7 +154,9 @@ module Fluent
|
|
144
154
|
def run
|
145
155
|
begin
|
146
156
|
$log.info "starting fluentd worker", pid: Process.pid, ppid: Process.ppid, worker: worker_id
|
147
|
-
|
157
|
+
@root_agent_mutex.synchronize do
|
158
|
+
start
|
159
|
+
end
|
148
160
|
|
149
161
|
@fluent_log_event_router.start
|
150
162
|
|
@@ -158,47 +170,51 @@ module Fluent
|
|
158
170
|
raise
|
159
171
|
end
|
160
172
|
|
161
|
-
|
173
|
+
@root_agent_mutex.synchronize do
|
174
|
+
stop_phase(@root_agent)
|
175
|
+
end
|
162
176
|
end
|
163
177
|
|
164
178
|
# @param conf [Fluent::Config]
|
165
179
|
# @param supervisor [Bool]
|
166
180
|
# @reutrn nil
|
167
181
|
def reload_config(conf, supervisor: false)
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
182
|
+
@root_agent_mutex.synchronize do
|
183
|
+
# configure first to reduce down time while restarting
|
184
|
+
new_agent = RootAgent.new(log: log, system_config: @system_config)
|
185
|
+
ret = Fluent::StaticConfigAnalysis.call(conf, workers: system_config.workers)
|
186
|
+
|
187
|
+
ret.all_plugins.each do |plugin|
|
188
|
+
if plugin.respond_to?(:reloadable_plugin?) && !plugin.reloadable_plugin?
|
189
|
+
raise Fluent::ConfigError, "Unreloadable plugin plugin: #{Fluent::Plugin.lookup_type_from_class(plugin.class)}, plugin_id: #{plugin.plugin_id}, class_name: #{plugin.class})"
|
190
|
+
end
|
175
191
|
end
|
176
|
-
end
|
177
192
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
193
|
+
# Assign @root_agent to new root_agent
|
194
|
+
# for https://github.com/fluent/fluentd/blob/fcef949ce40472547fde295ddd2cfe297e1eddd6/lib/fluent/plugin_helper/event_emitter.rb#L50
|
195
|
+
old_agent, @root_agent = @root_agent, new_agent
|
196
|
+
begin
|
197
|
+
@root_agent.configure(conf)
|
198
|
+
rescue
|
199
|
+
@root_agent = old_agent
|
200
|
+
raise
|
201
|
+
end
|
187
202
|
|
188
|
-
|
189
|
-
|
190
|
-
|
203
|
+
unless @suppress_config_dump
|
204
|
+
$log.info :supervisor, "using configuration file: #{conf.to_s.rstrip}"
|
205
|
+
end
|
191
206
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
207
|
+
# supervisor doesn't handle actual data. so the following code is unnecessary.
|
208
|
+
if supervisor
|
209
|
+
old_agent.shutdown # to close thread created in #configure
|
210
|
+
return
|
211
|
+
end
|
197
212
|
|
198
|
-
|
213
|
+
stop_phase(old_agent)
|
199
214
|
|
200
|
-
|
201
|
-
|
215
|
+
$log.info 'restart fluentd worker', worker: worker_id
|
216
|
+
start_phase(new_agent)
|
217
|
+
end
|
202
218
|
end
|
203
219
|
|
204
220
|
def stop
|
data/lib/fluent/env.rb
CHANGED
@@ -14,6 +14,8 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
+
require 'securerandom'
|
18
|
+
|
17
19
|
require 'serverengine/utils'
|
18
20
|
require 'fluent/oj_options'
|
19
21
|
|
@@ -25,6 +27,7 @@ module Fluent
|
|
25
27
|
DEFAULT_OJ_OPTIONS = Fluent::OjOptions.load_env
|
26
28
|
DEFAULT_DIR_PERMISSION = 0755
|
27
29
|
DEFAULT_FILE_PERMISSION = 0644
|
30
|
+
INSTANCE_ID = ENV['FLUENT_INSTANCE_ID'] || SecureRandom.uuid
|
28
31
|
|
29
32
|
def self.windows?
|
30
33
|
ServerEngine.windows?
|
data/lib/fluent/event_router.rb
CHANGED
@@ -286,7 +286,7 @@ module Fluent
|
|
286
286
|
|
287
287
|
def find(tag)
|
288
288
|
pipeline = nil
|
289
|
-
@match_rules.
|
289
|
+
@match_rules.each do |rule|
|
290
290
|
if rule.match?(tag)
|
291
291
|
if rule.collector.is_a?(Plugin::Filter)
|
292
292
|
pipeline ||= Pipeline.new
|
@@ -301,7 +301,7 @@ module Fluent
|
|
301
301
|
return pipeline
|
302
302
|
end
|
303
303
|
end
|
304
|
-
|
304
|
+
end
|
305
305
|
|
306
306
|
if pipeline
|
307
307
|
# filter is matched but no match
|
@@ -54,29 +54,32 @@ module Fluent::Plugin
|
|
54
54
|
@parser = parser_create
|
55
55
|
end
|
56
56
|
|
57
|
-
FAILED_RESULT = [nil, nil].freeze # reduce allocation cost
|
58
57
|
REPLACE_CHAR = '?'.freeze
|
59
58
|
|
60
|
-
def
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
59
|
+
def filter_stream(tag, es)
|
60
|
+
new_es = Fluent::MultiEventStream.new
|
61
|
+
es.each do |time, record|
|
62
|
+
begin
|
63
|
+
raw_value = @accessor.call(record)
|
64
|
+
if raw_value.nil?
|
65
|
+
new_es.add(time, handle_parsed(tag, record, time, {})) if @reserve_data
|
66
|
+
raise ArgumentError, "#{@key_name} does not exist"
|
67
|
+
else
|
68
|
+
filter_one_record(tag, time, record, raw_value) do |result_time, result_record|
|
69
|
+
new_es.add(result_time, result_record)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
rescue => e
|
73
|
+
router.emit_error_event(tag, time, record, e) if @emit_invalid_record_to_error
|
70
74
|
end
|
71
75
|
end
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
# This should be fixed in the future version.
|
77
|
-
result_time = nil
|
78
|
-
result_record = nil
|
76
|
+
new_es
|
77
|
+
end
|
78
|
+
|
79
|
+
private
|
79
80
|
|
81
|
+
def filter_one_record(tag, time, record, raw_value)
|
82
|
+
begin
|
80
83
|
@parser.parse(raw_value) do |t, values|
|
81
84
|
if values
|
82
85
|
t = if @reserve_time
|
@@ -85,38 +88,17 @@ module Fluent::Plugin
|
|
85
88
|
t.nil? ? time : t
|
86
89
|
end
|
87
90
|
@accessor.delete(record) if @remove_key_name_field
|
88
|
-
r = handle_parsed(tag, record, t, values)
|
89
|
-
|
90
|
-
if result_record.nil?
|
91
|
-
result_time = t
|
92
|
-
result_record = r
|
93
|
-
else
|
94
|
-
if @emit_invalid_record_to_error
|
95
|
-
router.emit_error_event(tag, t, r, Fluent::Plugin::Parser::ParserError.new(
|
96
|
-
"Could not emit the event. The parser returned multiple results, but currently filter_parser plugin only returns the first parsed result. Raw data: '#{raw_value}'"
|
97
|
-
))
|
98
|
-
end
|
99
|
-
end
|
100
91
|
else
|
101
|
-
if @emit_invalid_record_to_error
|
102
|
-
router.emit_error_event(tag, time, record, Fluent::Plugin::Parser::ParserError.new("pattern not matched with data '#{raw_value}'"))
|
103
|
-
end
|
104
|
-
|
92
|
+
router.emit_error_event(tag, time, record, Fluent::Plugin::Parser::ParserError.new("pattern not matched with data '#{raw_value}'")) if @emit_invalid_record_to_error
|
105
93
|
next unless @reserve_data
|
106
|
-
|
107
|
-
|
108
|
-
result_time = time
|
109
|
-
result_record = handle_parsed(tag, record, time, {})
|
94
|
+
t = time
|
95
|
+
values = {}
|
110
96
|
end
|
97
|
+
yield(t, handle_parsed(tag, record, t, values))
|
111
98
|
end
|
112
99
|
|
113
|
-
return result_time, result_record
|
114
100
|
rescue Fluent::Plugin::Parser::ParserError => e
|
115
|
-
|
116
|
-
raise e
|
117
|
-
else
|
118
|
-
return FAILED_RESULT
|
119
|
-
end
|
101
|
+
raise e
|
120
102
|
rescue ArgumentError => e
|
121
103
|
raise unless @replace_invalid_sequence
|
122
104
|
raise unless e.message.index("invalid byte sequence in") == 0
|
@@ -124,16 +106,10 @@ module Fluent::Plugin
|
|
124
106
|
raw_value = raw_value.scrub(REPLACE_CHAR)
|
125
107
|
retry
|
126
108
|
rescue => e
|
127
|
-
|
128
|
-
raise Fluent::Plugin::Parser::ParserError, "parse failed #{e.message}"
|
129
|
-
else
|
130
|
-
return FAILED_RESULT
|
131
|
-
end
|
109
|
+
raise Fluent::Plugin::Parser::ParserError, "parse failed #{e.message}"
|
132
110
|
end
|
133
111
|
end
|
134
112
|
|
135
|
-
private
|
136
|
-
|
137
113
|
def handle_parsed(tag, record, t, values)
|
138
114
|
if values && @inject_key_prefix
|
139
115
|
values = Hash[values.map { |k, v| [@inject_key_prefix + k, v] }]
|
@@ -84,6 +84,8 @@ module Fluent::Plugin
|
|
84
84
|
config_param :dump_error_log, :bool, default: true
|
85
85
|
desc 'Add QUERY_ prefix query params to record'
|
86
86
|
config_param :add_query_params, :bool, default: false
|
87
|
+
desc "Add prefix to incoming tag"
|
88
|
+
config_param :add_tag_prefix, :string, default: nil
|
87
89
|
|
88
90
|
config_section :parse do
|
89
91
|
config_set_default :@type, 'in_http'
|
@@ -120,6 +122,8 @@ module Fluent::Plugin
|
|
120
122
|
end
|
121
123
|
end
|
122
124
|
|
125
|
+
raise Fluent::ConfigError, "'add_tag_prefix' parameter must not be empty" if @add_tag_prefix && @add_tag_prefix.empty?
|
126
|
+
|
123
127
|
m = if @parser_configs.first['@type'] == 'in_http'
|
124
128
|
@parser_msgpack = parser_create(usage: 'parser_in_http_msgpack', type: 'msgpack')
|
125
129
|
@parser_msgpack.time_key = nil
|
@@ -203,6 +207,7 @@ module Fluent::Plugin
|
|
203
207
|
begin
|
204
208
|
path = path_info[1..-1] # remove /
|
205
209
|
tag = path.split('/').join('.')
|
210
|
+
tag = "#{@add_tag_prefix}.#{tag}" if @add_tag_prefix
|
206
211
|
|
207
212
|
mes = Fluent::MultiEventStream.new
|
208
213
|
parse_params(params) do |record_time, record|
|
data/lib/fluent/plugin/in_tcp.rb
CHANGED
data/lib/fluent/plugin/in_udp.rb
CHANGED
@@ -43,10 +43,15 @@ module Fluent::Plugin
|
|
43
43
|
desc "Remove newline from the end of incoming payload"
|
44
44
|
config_param :remove_newline, :bool, default: true
|
45
45
|
desc "The max size of socket receive buffer. SO_RCVBUF"
|
46
|
-
config_param :receive_buffer_size, :size, default: nil
|
46
|
+
config_param :receive_buffer_size, :size, default: nil, deprecated: "use receive_buffer_size in transport section instead."
|
47
47
|
|
48
48
|
config_param :blocking_timeout, :time, default: 0.5
|
49
49
|
|
50
|
+
# overwrite server plugin to change default to :udp and remove tcp/tls protocol from list
|
51
|
+
config_section :transport, required: false, multi: false, init: true, param_name: :transport_config do
|
52
|
+
config_argument :protocol, :enum, list: [:udp], default: :udp
|
53
|
+
end
|
54
|
+
|
50
55
|
def configure(conf)
|
51
56
|
compat_parameters_convert(conf, :parser)
|
52
57
|
parser_config = conf.elements('parse').first
|
@@ -65,6 +70,10 @@ module Fluent::Plugin
|
|
65
70
|
true
|
66
71
|
end
|
67
72
|
|
73
|
+
def zero_downtime_restart_ready?
|
74
|
+
true
|
75
|
+
end
|
76
|
+
|
68
77
|
def start
|
69
78
|
super
|
70
79
|
|
data/lib/fluent/plugin/input.rb
CHANGED
@@ -0,0 +1,40 @@
|
|
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/plugin/output'
|
18
|
+
|
19
|
+
module Fluent::Plugin
|
20
|
+
class BufferOutput < Output
|
21
|
+
Fluent::Plugin.register_output("buffer", self)
|
22
|
+
helpers :event_emitter
|
23
|
+
|
24
|
+
config_section :buffer do
|
25
|
+
config_set_default :@type, "file"
|
26
|
+
config_set_default :chunk_keys, ["tag"]
|
27
|
+
config_set_default :flush_mode, :interval
|
28
|
+
config_set_default :flush_interval, 10
|
29
|
+
end
|
30
|
+
|
31
|
+
def multi_workers_ready?
|
32
|
+
true
|
33
|
+
end
|
34
|
+
|
35
|
+
def write(chunk)
|
36
|
+
return if chunk.empty?
|
37
|
+
router.emit_stream(chunk.metadata.tag, Fluent::MessagePackEventStream.new(chunk.read))
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/fluent/plugin/output.rb
CHANGED
@@ -1384,6 +1384,7 @@ module Fluent
|
|
1384
1384
|
end
|
1385
1385
|
|
1386
1386
|
def submit_flush_once
|
1387
|
+
return unless @buffer_config.flush_thread_count > 0
|
1387
1388
|
# Without locks: it is rough but enough to select "next" writer selection
|
1388
1389
|
@output_flush_thread_current_position = (@output_flush_thread_current_position + 1) % @buffer_config.flush_thread_count
|
1389
1390
|
state = @output_flush_threads[@output_flush_thread_current_position]
|
@@ -1406,6 +1407,7 @@ module Fluent
|
|
1406
1407
|
end
|
1407
1408
|
|
1408
1409
|
def submit_flush_all
|
1410
|
+
return unless @buffer_config.flush_thread_count > 0
|
1409
1411
|
while !@retry && @buffer.queued?
|
1410
1412
|
submit_flush_once
|
1411
1413
|
sleep @buffer_config.flush_thread_burst_interval
|
@@ -33,6 +33,14 @@ module Fluent
|
|
33
33
|
|
34
34
|
if conf.client_cert_auth
|
35
35
|
ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
|
36
|
+
else
|
37
|
+
ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
38
|
+
end
|
39
|
+
|
40
|
+
if conf.ensure_fips
|
41
|
+
unless OpenSSL.fips_mode
|
42
|
+
raise Fluent::ConfigError, "Cannot enable FIPS compliant mode. OpenSSL FIPS configuration is disabled"
|
43
|
+
end
|
36
44
|
end
|
37
45
|
|
38
46
|
ctx.ca_file = conf.ca_path
|
@@ -26,6 +26,9 @@ module Fluent
|
|
26
26
|
|
27
27
|
def router
|
28
28
|
@_event_emitter_used_actually = true
|
29
|
+
|
30
|
+
return Engine.root_agent.source_only_router if @_event_emitter_force_source_only_router
|
31
|
+
|
29
32
|
if @_event_emitter_lazy_init
|
30
33
|
@router = @primary_instance.router
|
31
34
|
end
|
@@ -48,6 +51,14 @@ module Fluent
|
|
48
51
|
@_event_emitter_used_actually
|
49
52
|
end
|
50
53
|
|
54
|
+
def event_emitter_apply_source_only
|
55
|
+
@_event_emitter_force_source_only_router = true
|
56
|
+
end
|
57
|
+
|
58
|
+
def event_emitter_cancel_source_only
|
59
|
+
@_event_emitter_force_source_only_router = false
|
60
|
+
end
|
61
|
+
|
51
62
|
def event_emitter_router(label_name)
|
52
63
|
if label_name
|
53
64
|
if label_name == "@ROOT"
|
@@ -72,6 +83,7 @@ module Fluent
|
|
72
83
|
super
|
73
84
|
@_event_emitter_used_actually = false
|
74
85
|
@_event_emitter_lazy_init = false
|
86
|
+
@_event_emitter_force_source_only_router = false
|
75
87
|
@router = nil
|
76
88
|
end
|
77
89
|
|