fluentd 1.11.3 → 1.12.0
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/.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 +66 -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 +2 -1
- 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 +24 -0
- data/lib/fluent/plugin/formatter_csv.rb +1 -1
- data/lib/fluent/plugin/formatter_hash.rb +3 -1
- data/lib/fluent/plugin/formatter_json.rb +3 -1
- data/lib/fluent/plugin/formatter_ltsv.rb +5 -3
- data/lib/fluent/plugin/formatter_out_file.rb +6 -4
- data/lib/fluent/plugin/formatter_single_value.rb +4 -2
- data/lib/fluent/plugin/formatter_tsv.rb +4 -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/out_http.rb +20 -2
- data/lib/fluent/plugin/output.rb +14 -6
- data/lib/fluent/plugin_helper/http_server/compat/server.rb +1 -1
- data/lib/fluent/plugin_helper/inject.rb +4 -1
- data/lib/fluent/plugin_helper/retry_state.rb +4 -0
- data/lib/fluent/supervisor.rb +140 -43
- 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_binlog_reader.rb +22 -6
- 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_filter_stdout.rb +6 -1
- data/test/plugin/test_formatter_hash.rb +6 -3
- data/test/plugin/test_formatter_json.rb +14 -4
- data/test/plugin/test_formatter_ltsv.rb +13 -5
- data/test/plugin/test_formatter_out_file.rb +35 -14
- data/test/plugin/test_formatter_single_value.rb +12 -6
- data/test/plugin/test_formatter_tsv.rb +12 -4
- data/test/plugin/test_in_http.rb +25 -0
- data/test/plugin/test_in_tail.rb +430 -30
- data/test/plugin/test_out_file.rb +23 -18
- data/test/plugin/test_output.rb +12 -0
- data/test/plugin/test_parser_syslog.rb +2 -2
- data/test/plugin_helper/test_compat_parameters.rb +7 -2
- data/test/plugin_helper/test_inject.rb +42 -0
- data/test/test_capability.rb +74 -0
- data/test/test_formatter.rb +34 -10
- data/test/test_output.rb +6 -1
- data/test/test_supervisor.rb +119 -1
- metadata +33 -4
data/test/test_output.rb
CHANGED
@@ -230,6 +230,11 @@ module FluentOutputTest
|
|
230
230
|
setup do
|
231
231
|
@time = Time.parse("2011-01-02 13:14:15 UTC")
|
232
232
|
Timecop.freeze(@time)
|
233
|
+
@newline = if Fluent.windows?
|
234
|
+
"\r\n"
|
235
|
+
else
|
236
|
+
"\n"
|
237
|
+
end
|
233
238
|
end
|
234
239
|
|
235
240
|
teardown do
|
@@ -265,7 +270,7 @@ module FluentOutputTest
|
|
265
270
|
])
|
266
271
|
time = Time.parse("2016-11-08 12:00:00 UTC").to_i
|
267
272
|
d.emit({"a" => 1}, time)
|
268
|
-
d.expect_format %[2016-11-08T12:00:00Z\ttest\t{"a":1,"time":"2016-11-08T12:00:00Z"}
|
273
|
+
d.expect_format %[2016-11-08T12:00:00Z\ttest\t{"a":1,"time":"2016-11-08T12:00:00Z"}#{@newline}]
|
269
274
|
d.run
|
270
275
|
end
|
271
276
|
end
|
data/test/test_supervisor.rb
CHANGED
@@ -8,6 +8,10 @@ require 'net/http'
|
|
8
8
|
require 'uri'
|
9
9
|
require 'fileutils'
|
10
10
|
|
11
|
+
if Fluent.windows?
|
12
|
+
require 'win32/event'
|
13
|
+
end
|
14
|
+
|
11
15
|
class SupervisorTest < ::Test::Unit::TestCase
|
12
16
|
class DummyServer
|
13
17
|
include Fluent::ServerModule
|
@@ -107,6 +111,32 @@ class SupervisorTest < ::Test::Unit::TestCase
|
|
107
111
|
$log.out.reset if $log && $log.out && $log.out.respond_to?(:reset)
|
108
112
|
end
|
109
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
|
+
|
110
140
|
def test_supervisor_signal_handler
|
111
141
|
omit "Windows cannot handle signals" if Fluent.windows?
|
112
142
|
|
@@ -128,6 +158,60 @@ class SupervisorTest < ::Test::Unit::TestCase
|
|
128
158
|
$log.out.reset if $log && $log.out && $log.out.respond_to?(:reset)
|
129
159
|
end
|
130
160
|
|
161
|
+
def test_windows_shutdown_event
|
162
|
+
omit "Only for Windows platform" unless Fluent.windows?
|
163
|
+
|
164
|
+
server = DummyServer.new
|
165
|
+
def server.config
|
166
|
+
{:signame => "TestFluentdEvent"}
|
167
|
+
end
|
168
|
+
|
169
|
+
mock(server).stop(true)
|
170
|
+
stub(Process).kill.times(0)
|
171
|
+
|
172
|
+
server.install_windows_event_handler
|
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)
|
213
|
+
end
|
214
|
+
|
131
215
|
def test_rpc_server
|
132
216
|
omit "Windows cannot handle signals" if Fluent.windows?
|
133
217
|
|
@@ -150,7 +234,7 @@ class SupervisorTest < ::Test::Unit::TestCase
|
|
150
234
|
server.run_rpc_server
|
151
235
|
|
152
236
|
sv.send(:install_main_process_signal_handlers)
|
153
|
-
Net::HTTP.get
|
237
|
+
response = Net::HTTP.get(URI.parse('http://127.0.0.1:24447/api/plugins.flushBuffers'))
|
154
238
|
info_msg = '[info]: force flushing buffered events' + "\n"
|
155
239
|
|
156
240
|
server.stop_rpc_server
|
@@ -159,11 +243,45 @@ class SupervisorTest < ::Test::Unit::TestCase
|
|
159
243
|
# This test will be passed in such environment.
|
160
244
|
pend unless $log.out.logs.first
|
161
245
|
|
246
|
+
assert_equal('{"ok":true}', response)
|
162
247
|
assert{ $log.out.logs.first.end_with?(info_msg) }
|
163
248
|
ensure
|
164
249
|
$log.out.reset if $log.out.is_a?(Fluent::Test::DummyLogDevice)
|
165
250
|
end
|
166
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
|
+
|
167
285
|
def test_load_config
|
168
286
|
tmp_dir = "#{TMP_DIR}/dir/test_load_config.conf"
|
169
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: ruby
|
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
|
@@ -70,7 +84,7 @@ dependencies:
|
|
70
84
|
requirements:
|
71
85
|
- - ">="
|
72
86
|
- !ruby/object:Gem::Version
|
73
|
-
version: 2.
|
87
|
+
version: 2.2.2
|
74
88
|
- - "<"
|
75
89
|
- !ruby/object:Gem::Version
|
76
90
|
version: 3.0.0
|
@@ -80,7 +94,7 @@ dependencies:
|
|
80
94
|
requirements:
|
81
95
|
- - ">="
|
82
96
|
- !ruby/object:Gem::Version
|
83
|
-
version: 2.
|
97
|
+
version: 2.2.2
|
84
98
|
- - "<"
|
85
99
|
- !ruby/object:Gem::Version
|
86
100
|
version: 3.0.0
|
@@ -345,7 +359,9 @@ email:
|
|
345
359
|
executables:
|
346
360
|
- fluent-binlog-reader
|
347
361
|
- fluent-ca-generate
|
362
|
+
- fluent-cap-ctl
|
348
363
|
- fluent-cat
|
364
|
+
- fluent-ctl
|
349
365
|
- fluent-debug
|
350
366
|
- fluent-gem
|
351
367
|
- fluent-plugin-config-format
|
@@ -357,9 +373,11 @@ files:
|
|
357
373
|
- ".drone.yml"
|
358
374
|
- ".github/ISSUE_TEMPLATE.md"
|
359
375
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
376
|
+
- ".github/ISSUE_TEMPLATE/config.yml"
|
360
377
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
361
378
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
362
379
|
- ".github/workflows/issue-auto-closer.yml"
|
380
|
+
- ".github/workflows/stale-actions.yml"
|
363
381
|
- ".gitignore"
|
364
382
|
- ".gitlab-ci.yml"
|
365
383
|
- ".travis.yml"
|
@@ -377,7 +395,9 @@ files:
|
|
377
395
|
- appveyor.yml
|
378
396
|
- bin/fluent-binlog-reader
|
379
397
|
- bin/fluent-ca-generate
|
398
|
+
- bin/fluent-cap-ctl
|
380
399
|
- bin/fluent-cat
|
400
|
+
- bin/fluent-ctl
|
381
401
|
- bin/fluent-debug
|
382
402
|
- bin/fluent-gem
|
383
403
|
- bin/fluent-plugin-config-format
|
@@ -425,11 +445,14 @@ files:
|
|
425
445
|
- fluent.conf
|
426
446
|
- fluentd.gemspec
|
427
447
|
- lib/fluent/agent.rb
|
448
|
+
- lib/fluent/capability.rb
|
428
449
|
- lib/fluent/clock.rb
|
429
450
|
- lib/fluent/command/binlog_reader.rb
|
430
451
|
- lib/fluent/command/bundler_injection.rb
|
431
452
|
- lib/fluent/command/ca_generate.rb
|
453
|
+
- lib/fluent/command/cap_ctl.rb
|
432
454
|
- lib/fluent/command/cat.rb
|
455
|
+
- lib/fluent/command/ctl.rb
|
433
456
|
- lib/fluent/command/debug.rb
|
434
457
|
- lib/fluent/command/fluentd.rb
|
435
458
|
- lib/fluent/command/plugin_config_formatter.rb
|
@@ -675,6 +698,8 @@ files:
|
|
675
698
|
- templates/plugin_config_formatter/section.md.erb
|
676
699
|
- test/command/test_binlog_reader.rb
|
677
700
|
- test/command/test_ca_generate.rb
|
701
|
+
- test/command/test_cap_ctl.rb
|
702
|
+
- test/command/test_ctl.rb
|
678
703
|
- test/command/test_fluentd.rb
|
679
704
|
- test/command/test_plugin_config_formatter.rb
|
680
705
|
- test/command/test_plugin_generator.rb
|
@@ -851,6 +876,7 @@ files:
|
|
851
876
|
- test/scripts/fluent/plugin/out_test.rb
|
852
877
|
- test/scripts/fluent/plugin/out_test2.rb
|
853
878
|
- test/scripts/fluent/plugin/parser_known.rb
|
879
|
+
- test/test_capability.rb
|
854
880
|
- test/test_clock.rb
|
855
881
|
- test/test_config.rb
|
856
882
|
- test/test_configdsl.rb
|
@@ -909,6 +935,8 @@ summary: Fluentd event collector
|
|
909
935
|
test_files:
|
910
936
|
- test/command/test_binlog_reader.rb
|
911
937
|
- test/command/test_ca_generate.rb
|
938
|
+
- test/command/test_cap_ctl.rb
|
939
|
+
- test/command/test_ctl.rb
|
912
940
|
- test/command/test_fluentd.rb
|
913
941
|
- test/command/test_plugin_config_formatter.rb
|
914
942
|
- test/command/test_plugin_generator.rb
|
@@ -1085,6 +1113,7 @@ test_files:
|
|
1085
1113
|
- test/scripts/fluent/plugin/out_test.rb
|
1086
1114
|
- test/scripts/fluent/plugin/out_test2.rb
|
1087
1115
|
- test/scripts/fluent/plugin/parser_known.rb
|
1116
|
+
- test/test_capability.rb
|
1088
1117
|
- test/test_clock.rb
|
1089
1118
|
- test/test_config.rb
|
1090
1119
|
- test/test_configdsl.rb
|