fluentd 1.15.2-x86-mingw32 → 1.16.1-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.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.yaml +1 -0
- data/.github/ISSUE_TEMPLATE/feature_request.yaml +1 -0
- data/.github/workflows/linux-test.yaml +2 -2
- data/.github/workflows/macos-test.yaml +2 -2
- data/.github/workflows/stale-actions.yml +11 -9
- data/.github/workflows/windows-test.yaml +2 -2
- data/CHANGELOG.md +133 -0
- data/CONTRIBUTING.md +1 -1
- data/MAINTAINERS.md +5 -3
- data/README.md +0 -1
- data/SECURITY.md +5 -9
- data/fluentd.gemspec +2 -2
- data/lib/fluent/command/fluentd.rb +55 -64
- data/lib/fluent/config/yaml_parser/loader.rb +18 -1
- data/lib/fluent/daemon.rb +2 -4
- data/lib/fluent/event.rb +2 -2
- data/lib/fluent/file_wrapper.rb +137 -0
- data/lib/fluent/log/console_adapter.rb +66 -0
- data/lib/fluent/log.rb +35 -5
- data/lib/fluent/oj_options.rb +1 -2
- data/lib/fluent/plugin/base.rb +5 -7
- data/lib/fluent/plugin/buf_file.rb +32 -3
- data/lib/fluent/plugin/buf_file_single.rb +32 -3
- data/lib/fluent/plugin/buffer/file_chunk.rb +1 -1
- data/lib/fluent/plugin/buffer.rb +21 -0
- data/lib/fluent/plugin/in_tail.rb +1 -6
- data/lib/fluent/plugin/in_tcp.rb +47 -2
- data/lib/fluent/plugin/out_file.rb +0 -4
- data/lib/fluent/plugin/out_forward/ack_handler.rb +19 -4
- data/lib/fluent/plugin/out_forward.rb +2 -2
- data/lib/fluent/plugin/out_secondary_file.rb +39 -22
- data/lib/fluent/plugin/output.rb +49 -12
- data/lib/fluent/plugin_helper/http_server/server.rb +2 -1
- data/lib/fluent/plugin_helper/server.rb +8 -0
- data/lib/fluent/supervisor.rb +157 -232
- data/lib/fluent/test/driver/base.rb +11 -5
- data/lib/fluent/test/driver/filter.rb +4 -0
- data/lib/fluent/test/startup_shutdown.rb +6 -8
- data/lib/fluent/version.rb +1 -1
- data/templates/new_gem/test/helper.rb.erb +0 -1
- data/test/command/test_ctl.rb +1 -1
- data/test/command/test_fluentd.rb +168 -22
- data/test/command/test_plugin_config_formatter.rb +0 -1
- data/test/compat/test_parser.rb +5 -5
- data/test/config/test_system_config.rb +0 -8
- data/test/log/test_console_adapter.rb +110 -0
- data/test/plugin/out_forward/test_ack_handler.rb +39 -0
- data/test/plugin/test_base.rb +98 -0
- data/test/plugin/test_buf_file.rb +62 -23
- data/test/plugin/test_buf_file_single.rb +65 -0
- data/test/plugin/test_in_http.rb +2 -3
- data/test/plugin/test_in_monitor_agent.rb +2 -3
- data/test/plugin/test_in_tail.rb +105 -103
- data/test/plugin/test_in_tcp.rb +87 -2
- data/test/plugin/test_in_udp.rb +28 -0
- data/test/plugin/test_out_file.rb +3 -2
- data/test/plugin/test_out_forward.rb +14 -18
- data/test/plugin/test_out_http.rb +1 -0
- data/test/plugin/test_output.rb +269 -0
- data/test/plugin/test_output_as_buffered_compress.rb +32 -18
- data/test/plugin/test_parser_regexp.rb +1 -6
- data/test/plugin_helper/test_http_server_helper.rb +1 -1
- data/test/plugin_helper/test_server.rb +59 -5
- data/test/test_config.rb +57 -21
- data/test/{plugin/test_file_wrapper.rb → test_file_wrapper.rb} +2 -2
- data/test/test_formatter.rb +23 -20
- data/test/test_log.rb +85 -40
- data/test/test_supervisor.rb +300 -283
- metadata +15 -23
- data/.drone.yml +0 -35
- data/.github/workflows/issue-auto-closer.yml +0 -12
- data/.gitlab-ci.yml +0 -103
- data/lib/fluent/plugin/file_wrapper.rb +0 -131
- data/test/test_logger_initializer.rb +0 -46
@@ -1151,15 +1151,13 @@ class FileBufferTest < Test::Unit::TestCase
|
|
1151
1151
|
|
1152
1152
|
sub_test_case 'there are existing broken file chunks' do
|
1153
1153
|
setup do
|
1154
|
+
@id_output = 'backup_test'
|
1154
1155
|
@bufdir = File.expand_path('../../tmp/broken_buffer_file', __FILE__)
|
1155
|
-
FileUtils.
|
1156
|
+
FileUtils.rm_rf @bufdir rescue nil
|
1157
|
+
FileUtils.mkdir_p @bufdir
|
1156
1158
|
@bufpath = File.join(@bufdir, 'broken_test.*.log')
|
1157
1159
|
|
1158
1160
|
Fluent::Test.setup
|
1159
|
-
@d = FluentPluginFileBufferTest::DummyOutputPlugin.new
|
1160
|
-
@p = Fluent::Plugin::FileBuffer.new
|
1161
|
-
@p.owner = @d
|
1162
|
-
@p.configure(config_element('buffer', '', {'path' => @bufpath}))
|
1163
1161
|
end
|
1164
1162
|
|
1165
1163
|
teardown do
|
@@ -1171,12 +1169,12 @@ class FileBufferTest < Test::Unit::TestCase
|
|
1171
1169
|
@p.close unless @p.closed?
|
1172
1170
|
@p.terminate unless @p.terminated?
|
1173
1171
|
end
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1172
|
+
end
|
1173
|
+
|
1174
|
+
def setup_plugins(buf_conf)
|
1175
|
+
@d = FluentPluginFileBufferTest::DummyOutputPlugin.new
|
1176
|
+
@d.configure(config_element('ROOT', '', {'@id' => @id_output}, [config_element('buffer', '', buf_conf)]))
|
1177
|
+
@p = @d.buffer
|
1180
1178
|
end
|
1181
1179
|
|
1182
1180
|
def create_first_chunk(mode)
|
@@ -1232,44 +1230,85 @@ class FileBufferTest < Test::Unit::TestCase
|
|
1232
1230
|
assert { logs.any? { |log| log.include?(msg) } }
|
1233
1231
|
end
|
1234
1232
|
|
1235
|
-
test '#resume
|
1236
|
-
|
1233
|
+
test '#resume backups staged empty chunk' do
|
1234
|
+
setup_plugins({'path' => @bufpath})
|
1235
|
+
c1id, p1 = create_first_chunk('b')
|
1237
1236
|
File.open(p1, 'wb') { |f| } # create staged empty chunk file
|
1238
1237
|
c2id, _ = create_second_chunk('b')
|
1239
1238
|
|
1240
|
-
@
|
1239
|
+
Fluent::SystemConfig.overwrite_system_config('root_dir' => @bufdir) do
|
1240
|
+
@p.start
|
1241
|
+
end
|
1242
|
+
|
1241
1243
|
compare_staged_chunk(@p.stage, c2id, '2016-04-17 14:01:00 -0700', 3, :staged)
|
1242
1244
|
compare_log(@p, 'staged file chunk is empty')
|
1245
|
+
assert { not File.exist?(p1) }
|
1246
|
+
assert { File.exist?("#{@bufdir}/backup/worker0/#{@id_output}/#{@d.dump_unique_id_hex(c1id)}.log") }
|
1243
1247
|
end
|
1244
1248
|
|
1245
|
-
test '#resume
|
1249
|
+
test '#resume backups staged broken metadata' do
|
1250
|
+
setup_plugins({'path' => @bufpath})
|
1246
1251
|
c1id, _ = create_first_chunk('b')
|
1247
|
-
|
1252
|
+
c2id, p2 = create_second_chunk('b')
|
1248
1253
|
File.open(p2 + '.meta', 'wb') { |f| f.write("\0" * 70) } # create staged broken meta file
|
1249
1254
|
|
1250
|
-
@
|
1255
|
+
Fluent::SystemConfig.overwrite_system_config('root_dir' => @bufdir) do
|
1256
|
+
@p.start
|
1257
|
+
end
|
1258
|
+
|
1251
1259
|
compare_staged_chunk(@p.stage, c1id, '2016-04-17 14:00:00 -0700', 4, :staged)
|
1252
1260
|
compare_log(@p, 'staged meta file is broken')
|
1261
|
+
assert { not File.exist?(p2) }
|
1262
|
+
assert { File.exist?("#{@bufdir}/backup/worker0/#{@id_output}/#{@d.dump_unique_id_hex(c2id)}.log") }
|
1253
1263
|
end
|
1254
1264
|
|
1255
|
-
test '#resume
|
1256
|
-
|
1265
|
+
test '#resume backups enqueued empty chunk' do
|
1266
|
+
setup_plugins({'path' => @bufpath})
|
1267
|
+
c1id, p1 = create_first_chunk('q')
|
1257
1268
|
File.open(p1, 'wb') { |f| } # create enqueued empty chunk file
|
1258
1269
|
c2id, _ = create_second_chunk('q')
|
1259
1270
|
|
1260
|
-
@
|
1271
|
+
Fluent::SystemConfig.overwrite_system_config('root_dir' => @bufdir) do
|
1272
|
+
@p.start
|
1273
|
+
end
|
1274
|
+
|
1261
1275
|
compare_queued_chunk(@p.queue, c2id, 3, :queued)
|
1262
1276
|
compare_log(@p, 'enqueued file chunk is empty')
|
1277
|
+
assert { not File.exist?(p1) }
|
1278
|
+
assert { File.exist?("#{@bufdir}/backup/worker0/#{@id_output}/#{@d.dump_unique_id_hex(c1id)}.log") }
|
1263
1279
|
end
|
1264
1280
|
|
1265
|
-
test '#resume
|
1281
|
+
test '#resume backups enqueued broken metadata' do
|
1282
|
+
setup_plugins({'path' => @bufpath})
|
1266
1283
|
c1id, _ = create_first_chunk('q')
|
1267
|
-
|
1284
|
+
c2id, p2 = create_second_chunk('q')
|
1268
1285
|
File.open(p2 + '.meta', 'wb') { |f| f.write("\0" * 70) } # create enqueued broken meta file
|
1269
1286
|
|
1270
|
-
@
|
1287
|
+
Fluent::SystemConfig.overwrite_system_config('root_dir' => @bufdir) do
|
1288
|
+
@p.start
|
1289
|
+
end
|
1290
|
+
|
1271
1291
|
compare_queued_chunk(@p.queue, c1id, 4, :queued)
|
1272
1292
|
compare_log(@p, 'enqueued meta file is broken')
|
1293
|
+
assert { not File.exist?(p2) }
|
1294
|
+
assert { File.exist?("#{@bufdir}/backup/worker0/#{@id_output}/#{@d.dump_unique_id_hex(c2id)}.log") }
|
1295
|
+
end
|
1296
|
+
|
1297
|
+
test '#resume throws away broken chunk with disable_chunk_backup' do
|
1298
|
+
setup_plugins({'path' => @bufpath, 'disable_chunk_backup' => true})
|
1299
|
+
c1id, _ = create_first_chunk('b')
|
1300
|
+
c2id, p2 = create_second_chunk('b')
|
1301
|
+
File.open(p2 + '.meta', 'wb') { |f| f.write("\0" * 70) } # create staged broken meta file
|
1302
|
+
|
1303
|
+
Fluent::SystemConfig.overwrite_system_config('root_dir' => @bufdir) do
|
1304
|
+
@p.start
|
1305
|
+
end
|
1306
|
+
|
1307
|
+
compare_staged_chunk(@p.stage, c1id, '2016-04-17 14:00:00 -0700', 4, :staged)
|
1308
|
+
compare_log(@p, 'staged meta file is broken')
|
1309
|
+
compare_log(@p, 'disable_chunk_backup is true')
|
1310
|
+
assert { not File.exist?(p2) }
|
1311
|
+
assert { not File.exist?("#{@bufdir}/backup/worker0/#{@id_output}/#{@d.dump_unique_id_hex(c2id)}.log") }
|
1273
1312
|
end
|
1274
1313
|
end
|
1275
1314
|
end
|
@@ -830,4 +830,69 @@ class FileSingleBufferTest < Test::Unit::TestCase
|
|
830
830
|
assert_equal :queued, queue[0].state
|
831
831
|
end
|
832
832
|
end
|
833
|
+
|
834
|
+
sub_test_case 'there are existing broken file chunks' do
|
835
|
+
setup do
|
836
|
+
FileUtils.rm_rf(@bufdir) rescue nil
|
837
|
+
FileUtils.mkdir_p(@bufdir)
|
838
|
+
end
|
839
|
+
|
840
|
+
teardown do
|
841
|
+
return unless @p
|
842
|
+
|
843
|
+
@p.stop unless @p.stopped?
|
844
|
+
@p.before_shutdown unless @p.before_shutdown?
|
845
|
+
@p.shutdown unless @p.shutdown?
|
846
|
+
@p.after_shutdown unless @p.after_shutdown?
|
847
|
+
@p.close unless @p.closed?
|
848
|
+
@p.terminate unless @p.terminated?
|
849
|
+
end
|
850
|
+
|
851
|
+
test '#resume backups empty chunk' do
|
852
|
+
id_output = 'backup_test'
|
853
|
+
@d = create_driver(%[
|
854
|
+
@id #{id_output}
|
855
|
+
<buffer tag>
|
856
|
+
@type file_single
|
857
|
+
path #{PATH}
|
858
|
+
</buffer>
|
859
|
+
])
|
860
|
+
@p = @d.instance.buffer
|
861
|
+
|
862
|
+
c1id = Fluent::UniqueId.generate
|
863
|
+
p1 = File.join(@bufdir, "fsb.foo.b#{Fluent::UniqueId.hex(c1id)}.buf")
|
864
|
+
File.open(p1, 'wb') { |f| } # create empty chunk file
|
865
|
+
|
866
|
+
Fluent::SystemConfig.overwrite_system_config('root_dir' => @bufdir) do
|
867
|
+
@p.start
|
868
|
+
end
|
869
|
+
|
870
|
+
assert { not File.exist?(p1) }
|
871
|
+
assert { File.exist?("#{@bufdir}/backup/worker0/#{id_output}/#{@d.instance.dump_unique_id_hex(c1id)}.log") }
|
872
|
+
end
|
873
|
+
|
874
|
+
test '#resume throws away broken chunk with disable_chunk_backup' do
|
875
|
+
id_output = 'backup_test'
|
876
|
+
@d = create_driver(%[
|
877
|
+
@id #{id_output}
|
878
|
+
<buffer tag>
|
879
|
+
@type file_single
|
880
|
+
path #{PATH}
|
881
|
+
disable_chunk_backup true
|
882
|
+
</buffer>
|
883
|
+
])
|
884
|
+
@p = @d.instance.buffer
|
885
|
+
|
886
|
+
c1id = Fluent::UniqueId.generate
|
887
|
+
p1 = File.join(@bufdir, "fsb.foo.b#{Fluent::UniqueId.hex(c1id)}.buf")
|
888
|
+
File.open(p1, 'wb') { |f| } # create empty chunk file
|
889
|
+
|
890
|
+
Fluent::SystemConfig.overwrite_system_config('root_dir' => @bufdir) do
|
891
|
+
@p.start
|
892
|
+
end
|
893
|
+
|
894
|
+
assert { not File.exist?(p1) }
|
895
|
+
assert { not File.exist?("#{@bufdir}/backup/worker0/#{id_output}/#{@d.instance.dump_unique_id_hex(c1id)}.log") }
|
896
|
+
end
|
897
|
+
end
|
833
898
|
end
|
data/test/plugin/test_in_http.rb
CHANGED
@@ -7,9 +7,8 @@ require 'timecop'
|
|
7
7
|
class HttpInputTest < Test::Unit::TestCase
|
8
8
|
class << self
|
9
9
|
def startup
|
10
|
-
|
11
|
-
|
12
|
-
ENV['SERVERENGINE_SOCKETMANAGER_PATH'] = socket_manager_path.to_s
|
10
|
+
@server = ServerEngine::SocketManager::Server.open
|
11
|
+
ENV['SERVERENGINE_SOCKETMANAGER_PATH'] = @server.path.to_s
|
13
12
|
end
|
14
13
|
|
15
14
|
def shutdown
|
@@ -355,14 +355,13 @@ EOC
|
|
355
355
|
|
356
356
|
test "fluentd opts" do
|
357
357
|
d = create_driver
|
358
|
-
opts = Fluent::Supervisor.default_options
|
359
358
|
|
360
359
|
filepath = nil
|
361
360
|
begin
|
362
361
|
FileUtils.mkdir_p(CONFIG_DIR)
|
363
362
|
filepath = File.expand_path('fluentd.conf', CONFIG_DIR)
|
364
363
|
FileUtils.touch(filepath)
|
365
|
-
s = Fluent::Supervisor.new(
|
364
|
+
s = Fluent::Supervisor.new({config_path: filepath})
|
366
365
|
s.configure
|
367
366
|
ensure
|
368
367
|
FileUtils.rm_r(CONFIG_DIR) rescue _
|
@@ -502,7 +501,7 @@ EOC
|
|
502
501
|
v.puts(conf)
|
503
502
|
end
|
504
503
|
|
505
|
-
@supervisor = Fluent::Supervisor.new(
|
504
|
+
@supervisor = Fluent::Supervisor.new({config_path: @filepath})
|
506
505
|
@supervisor.configure
|
507
506
|
ensure
|
508
507
|
FileUtils.rm_r(CONFIG_DIR) rescue _
|