fluentd 1.16.1-x64-mingw32 → 1.16.3-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/linux-test.yaml +2 -2
- data/.github/workflows/macos-test.yaml +2 -2
- data/.github/workflows/windows-test.yaml +2 -2
- data/CHANGELOG.md +50 -0
- data/Rakefile +1 -1
- data/fluentd.gemspec +1 -1
- data/lib/fluent/command/ctl.rb +2 -2
- data/lib/fluent/command/plugin_config_formatter.rb +1 -1
- data/lib/fluent/config/dsl.rb +1 -1
- data/lib/fluent/config/v1_parser.rb +2 -2
- data/lib/fluent/counter/server.rb +1 -1
- data/lib/fluent/counter/validator.rb +3 -3
- data/lib/fluent/engine.rb +1 -1
- data/lib/fluent/event.rb +6 -2
- data/lib/fluent/log.rb +9 -0
- data/lib/fluent/match.rb +1 -1
- data/lib/fluent/msgpack_factory.rb +6 -1
- data/lib/fluent/plugin/base.rb +1 -1
- data/lib/fluent/plugin/buffer.rb +1 -1
- data/lib/fluent/plugin/filter_record_transformer.rb +1 -1
- data/lib/fluent/plugin/in_forward.rb +1 -1
- data/lib/fluent/plugin/in_http.rb +8 -8
- data/lib/fluent/plugin/in_sample.rb +1 -1
- data/lib/fluent/plugin/in_tail/position_file.rb +32 -18
- data/lib/fluent/plugin/in_tail.rb +81 -25
- data/lib/fluent/plugin/out_exec_filter.rb +2 -2
- data/lib/fluent/plugin/output.rb +1 -1
- data/lib/fluent/plugin/parser_json.rb +1 -1
- data/lib/fluent/plugin_helper/event_loop.rb +2 -2
- data/lib/fluent/plugin_helper/record_accessor.rb +1 -1
- data/lib/fluent/plugin_helper/thread.rb +3 -3
- data/lib/fluent/plugin_id.rb +1 -1
- data/lib/fluent/supervisor.rb +1 -1
- data/lib/fluent/system_config.rb +1 -1
- data/lib/fluent/version.rb +1 -1
- data/test/config/test_system_config.rb +2 -2
- data/test/plugin/in_tail/test_position_file.rb +31 -1
- data/test/plugin/test_base.rb +1 -1
- data/test/plugin/test_buffer_chunk.rb +11 -0
- data/test/plugin/test_in_forward.rb +9 -9
- data/test/plugin/test_in_tail.rb +484 -0
- data/test/plugin/test_in_unix.rb +2 -2
- data/test/plugin/test_multi_output.rb +1 -1
- data/test/plugin/test_out_exec_filter.rb +2 -2
- data/test/plugin/test_out_file.rb +2 -2
- data/test/plugin/test_output.rb +12 -12
- data/test/plugin/test_output_as_buffered.rb +44 -44
- data/test/plugin/test_output_as_buffered_retries.rb +1 -1
- data/test/plugin/test_output_as_buffered_secondary.rb +2 -2
- data/test/plugin_helper/test_child_process.rb +2 -2
- data/test/plugin_helper/test_server.rb +1 -1
- data/test/test_log.rb +38 -1
- data/test/test_msgpack_factory.rb +32 -0
- data/test/test_supervisor.rb +13 -0
- metadata +5 -5
@@ -370,17 +370,52 @@ module Fluent::Plugin
|
|
370
370
|
def refresh_watchers
|
371
371
|
target_paths_hash = expand_paths
|
372
372
|
existence_paths_hash = existence_path
|
373
|
-
|
373
|
+
|
374
374
|
log.debug {
|
375
375
|
target_paths_str = target_paths_hash.collect { |key, target_info| target_info.path }.join(",")
|
376
376
|
existence_paths_str = existence_paths_hash.collect { |key, target_info| target_info.path }.join(",")
|
377
377
|
"tailing paths: target = #{target_paths_str} | existing = #{existence_paths_str}"
|
378
378
|
}
|
379
379
|
|
380
|
-
|
380
|
+
if !@follow_inodes
|
381
|
+
need_unwatch_in_stop_watchers = true
|
382
|
+
else
|
383
|
+
# When using @follow_inodes, need this to unwatch the rotated old inode when it disappears.
|
384
|
+
# After `update_watcher` detaches an old TailWatcher, the inode is lost from the `@tails`.
|
385
|
+
# So that inode can't be contained in `removed_hash`, and can't be unwatched by `stop_watchers`.
|
386
|
+
#
|
387
|
+
# This logic may work for `@follow_inodes false` too.
|
388
|
+
# Just limiting the case to suppress the impact to existing logics.
|
389
|
+
@pf&.unwatch_removed_targets(target_paths_hash)
|
390
|
+
need_unwatch_in_stop_watchers = false
|
391
|
+
end
|
392
|
+
|
393
|
+
removed_hash = existence_paths_hash.reject {|key, value| target_paths_hash.key?(key)}
|
381
394
|
added_hash = target_paths_hash.reject {|key, value| existence_paths_hash.key?(key)}
|
382
395
|
|
383
|
-
|
396
|
+
# If an exisiting TailWatcher already follows a target path with the different inode,
|
397
|
+
# it means that the TailWatcher following the rotated file still exists. In this case,
|
398
|
+
# `refresh_watcher` can't start the new TailWatcher for the new current file. So, we
|
399
|
+
# should output a warning log in order to prevent silent collection stops.
|
400
|
+
# (Such as https://github.com/fluent/fluentd/pull/4327)
|
401
|
+
# (Usually, such a TailWatcher should be removed from `@tails` in `update_watcher`.)
|
402
|
+
# (The similar warning may work for `@follow_inodes true` too. Just limiting the case
|
403
|
+
# to suppress the impact to existing logics.)
|
404
|
+
unless @follow_inodes
|
405
|
+
target_paths_hash.each do |path, target|
|
406
|
+
next unless @tails.key?(path)
|
407
|
+
# We can't use `existence_paths_hash[path].ino` because it is from `TailWatcher.ino`,
|
408
|
+
# which is very unstable parameter. (It can be `nil` or old).
|
409
|
+
# So, we need to use `TailWatcher.pe.read_inode`.
|
410
|
+
existing_watcher_inode = @tails[path].pe.read_inode
|
411
|
+
if existing_watcher_inode != target.ino
|
412
|
+
log.warn "Could not follow a file (inode: #{target.ino}) because an existing watcher for that filepath follows a different inode: #{existing_watcher_inode} (e.g. keeps watching a already rotated file). If you keep getting this message, please restart Fluentd.",
|
413
|
+
filepath: target.path
|
414
|
+
end
|
415
|
+
end
|
416
|
+
end
|
417
|
+
|
418
|
+
stop_watchers(removed_hash, unwatched: need_unwatch_in_stop_watchers) unless removed_hash.empty?
|
384
419
|
start_watchers(added_hash) unless added_hash.empty?
|
385
420
|
@startup = false if @startup
|
386
421
|
end
|
@@ -484,8 +519,26 @@ module Fluent::Plugin
|
|
484
519
|
end
|
485
520
|
|
486
521
|
# refresh_watchers calls @tails.keys so we don't use stop_watcher -> start_watcher sequence for safety.
|
487
|
-
def update_watcher(
|
488
|
-
|
522
|
+
def update_watcher(tail_watcher, pe, new_inode)
|
523
|
+
# TODO we should use another callback for this.
|
524
|
+
# To supress impact to existing logics, limit the case to `@follow_inodes`.
|
525
|
+
# We may not need `@follow_inodes` condition.
|
526
|
+
if @follow_inodes && new_inode.nil?
|
527
|
+
# nil inode means the file disappeared, so we only need to stop it.
|
528
|
+
@tails.delete(tail_watcher.path)
|
529
|
+
# https://github.com/fluent/fluentd/pull/4237#issuecomment-1633358632
|
530
|
+
# Because of this problem, log duplication can occur during `rotate_wait`.
|
531
|
+
# Need to set `rotate_wait 0` for a workaround.
|
532
|
+
# Duplication will occur if `refresh_watcher` is called during the `rotate_wait`.
|
533
|
+
# In that case, `refresh_watcher` will add the new TailWatcher to tail the same target,
|
534
|
+
# and it causes the log duplication.
|
535
|
+
# (Other `detach_watcher_after_rotate_wait` may have the same problem.
|
536
|
+
# We need the mechanism not to add duplicated TailWathcer with detaching TailWatcher.)
|
537
|
+
detach_watcher_after_rotate_wait(tail_watcher, pe.read_inode)
|
538
|
+
return
|
539
|
+
end
|
540
|
+
|
541
|
+
path = tail_watcher.path
|
489
542
|
|
490
543
|
log.info("detected rotation of #{path}; waiting #{@rotate_wait} seconds")
|
491
544
|
|
@@ -499,23 +552,22 @@ module Fluent::Plugin
|
|
499
552
|
end
|
500
553
|
end
|
501
554
|
|
502
|
-
|
555
|
+
new_target_info = TargetInfo.new(path, new_inode)
|
503
556
|
|
504
557
|
if @follow_inodes
|
505
|
-
new_position_entry = @pf[
|
506
|
-
|
558
|
+
new_position_entry = @pf[new_target_info]
|
559
|
+
# If `refresh_watcher` find the new file before, this will not be zero.
|
560
|
+
# In this case, only we have to do is detaching the current tail_watcher.
|
507
561
|
if new_position_entry.read_inode == 0
|
508
|
-
|
509
|
-
# So it should be unwatched here explicitly.
|
510
|
-
rotated_tw.unwatched = true if rotated_tw
|
511
|
-
@tails[path] = setup_watcher(target_info, new_position_entry)
|
562
|
+
@tails[path] = setup_watcher(new_target_info, new_position_entry)
|
512
563
|
@tails[path].on_notify
|
513
564
|
end
|
514
565
|
else
|
515
|
-
@tails[path] = setup_watcher(
|
566
|
+
@tails[path] = setup_watcher(new_target_info, pe)
|
516
567
|
@tails[path].on_notify
|
517
568
|
end
|
518
|
-
|
569
|
+
|
570
|
+
detach_watcher_after_rotate_wait(tail_watcher, pe.read_inode)
|
519
571
|
end
|
520
572
|
|
521
573
|
# TailWatcher#close is called by another thread at shutdown phase.
|
@@ -523,6 +575,10 @@ module Fluent::Plugin
|
|
523
575
|
# so adding close_io argument to avoid this problem.
|
524
576
|
# At shutdown, IOHandler's io will be released automatically after detached the event loop
|
525
577
|
def detach_watcher(tw, ino, close_io = true)
|
578
|
+
if @follow_inodes && tw.ino != ino
|
579
|
+
log.warn("detach_watcher could be detaching an unexpected tail_watcher with a different ino.",
|
580
|
+
path: tw.path, actual_ino_in_tw: tw.ino, expect_ino_to_close: ino)
|
581
|
+
end
|
526
582
|
tw.watchers.each do |watcher|
|
527
583
|
event_loop_detach(watcher)
|
528
584
|
end
|
@@ -530,7 +586,7 @@ module Fluent::Plugin
|
|
530
586
|
|
531
587
|
tw.close if close_io
|
532
588
|
|
533
|
-
if tw.unwatched && @
|
589
|
+
if @pf && tw.unwatched && (@follow_inode || !@tails[tw.path])
|
534
590
|
target_info = TargetInfo.new(tw.path, ino)
|
535
591
|
@pf.unwatch(target_info)
|
536
592
|
end
|
@@ -778,7 +834,7 @@ module Fluent::Plugin
|
|
778
834
|
attr_accessor :group_watcher
|
779
835
|
|
780
836
|
def tag
|
781
|
-
@parsed_tag ||= @path.tr('/', '.').
|
837
|
+
@parsed_tag ||= @path.tr('/', '.').squeeze('.').gsub(/^\./, '')
|
782
838
|
end
|
783
839
|
|
784
840
|
def register_watcher(watcher)
|
@@ -874,21 +930,21 @@ module Fluent::Plugin
|
|
874
930
|
|
875
931
|
if watcher_needs_update
|
876
932
|
if @follow_inodes
|
877
|
-
#
|
878
|
-
#
|
879
|
-
#
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
933
|
+
# If stat is nil (file not present), NEED to stop and discard this watcher.
|
934
|
+
# When the file is disappeared but is resurrected soon, then `#refresh_watcher`
|
935
|
+
# can't recognize this TailWatcher needs to be stopped.
|
936
|
+
# This can happens when the file is rotated.
|
937
|
+
# If a notify comes before the new file for the path is created during rotation,
|
938
|
+
# then it appears as if the file was resurrected once it disappeared.
|
939
|
+
# Don't want to swap state because we need latest read offset in pos file even after rotate_wait
|
940
|
+
@update_watcher.call(self, @pe, stat&.ino)
|
884
941
|
else
|
885
942
|
# Permit to handle if stat is nil (file not present).
|
886
943
|
# If a file is mv-ed and a new file is created during
|
887
944
|
# calling `#refresh_watchers`s, and `#refresh_watchers` won't run `#start_watchers`
|
888
945
|
# and `#stop_watchers()` for the path because `target_paths_hash`
|
889
946
|
# always contains the path.
|
890
|
-
|
891
|
-
@update_watcher.call(target_info, swap_state(@pe))
|
947
|
+
@update_watcher.call(self, swap_state(@pe), stat&.ino)
|
892
948
|
end
|
893
949
|
else
|
894
950
|
@log.info "detected rotation of #{@path}"
|
@@ -163,7 +163,7 @@ module Fluent::Plugin
|
|
163
163
|
0
|
164
164
|
elsif (@child_respawn == 'inf') || (@child_respawn == '-1')
|
165
165
|
-1
|
166
|
-
elsif @child_respawn
|
166
|
+
elsif /^\d+$/.match?(@child_respawn)
|
167
167
|
@child_respawn.to_i
|
168
168
|
else
|
169
169
|
raise ConfigError, "child_respawn option argument invalid: none(or 0), inf(or -1) or positive number"
|
@@ -187,7 +187,7 @@ module Fluent::Plugin
|
|
187
187
|
@rr = 0
|
188
188
|
|
189
189
|
exit_callback = ->(status){
|
190
|
-
c = @children.
|
190
|
+
c = @children.find{|child| child.pid == status.pid }
|
191
191
|
if c
|
192
192
|
unless self.stopped?
|
193
193
|
log.warn "child process exits with error code", code: status.to_i, status: status.exitstatus, signal: status.termsig
|
data/lib/fluent/plugin/output.rb
CHANGED
@@ -824,7 +824,7 @@ module Fluent
|
|
824
824
|
if str.include?('${tag}')
|
825
825
|
rvalue = rvalue.gsub('${tag}', metadata.tag)
|
826
826
|
end
|
827
|
-
if str
|
827
|
+
if CHUNK_TAG_PLACEHOLDER_PATTERN.match?(str)
|
828
828
|
hash = {}
|
829
829
|
tag_parts = metadata.tag.split('.')
|
830
830
|
tag_parts.each_with_index do |part, i|
|
@@ -99,7 +99,7 @@ module Fluent
|
|
99
99
|
|
100
100
|
def shutdown
|
101
101
|
@_event_loop_mutex.synchronize do
|
102
|
-
@_event_loop_attached_watchers.
|
102
|
+
@_event_loop_attached_watchers.reverse_each do |w|
|
103
103
|
if w.attached?
|
104
104
|
begin
|
105
105
|
w.detach
|
@@ -116,7 +116,7 @@ module Fluent
|
|
116
116
|
def after_shutdown
|
117
117
|
timeout_at = Fluent::Clock.now + EVENT_LOOP_SHUTDOWN_TIMEOUT
|
118
118
|
@_event_loop_mutex.synchronize do
|
119
|
-
@_event_loop.watchers.
|
119
|
+
@_event_loop.watchers.reverse_each do |w|
|
120
120
|
begin
|
121
121
|
w.detach
|
122
122
|
rescue => e
|
@@ -119,7 +119,7 @@ module Fluent
|
|
119
119
|
def self.validate_dot_keys(keys)
|
120
120
|
keys.each { |key|
|
121
121
|
next unless key.is_a?(String)
|
122
|
-
if /\s+/.match(key)
|
122
|
+
if /\s+/.match?(key)
|
123
123
|
raise Fluent::ConfigError, "whitespace character is not allowed in dot notation. Use bracket notation: #{key}"
|
124
124
|
end
|
125
125
|
}
|
@@ -101,16 +101,16 @@ module Fluent
|
|
101
101
|
end
|
102
102
|
|
103
103
|
def thread_exist?(title)
|
104
|
-
@_threads.values.
|
104
|
+
@_threads.values.count{|thread| title == thread[:_fluentd_plugin_helper_thread_title] } > 0
|
105
105
|
end
|
106
106
|
|
107
107
|
def thread_started?(title)
|
108
|
-
t = @_threads.values.
|
108
|
+
t = @_threads.values.find{|thread| title == thread[:_fluentd_plugin_helper_thread_title] }
|
109
109
|
t && t[:_fluentd_plugin_helper_thread_started]
|
110
110
|
end
|
111
111
|
|
112
112
|
def thread_running?(title)
|
113
|
-
t = @_threads.values.
|
113
|
+
t = @_threads.values.find{|thread| title == thread[:_fluentd_plugin_helper_thread_title] }
|
114
114
|
t && t[:_fluentd_plugin_helper_thread_running]
|
115
115
|
end
|
116
116
|
|
data/lib/fluent/plugin_id.rb
CHANGED
@@ -49,7 +49,7 @@ module Fluent
|
|
49
49
|
# Thread::Backtrace::Location#path returns base filename or absolute path.
|
50
50
|
# #absolute_path returns absolute_path always.
|
51
51
|
# https://bugs.ruby-lang.org/issues/12159
|
52
|
-
if
|
52
|
+
if /\/test_[^\/]+\.rb$/.match?(location.absolute_path) # location.path =~ /test_.+\.rb$/
|
53
53
|
return true
|
54
54
|
end
|
55
55
|
end
|
data/lib/fluent/supervisor.rb
CHANGED
@@ -697,7 +697,7 @@ module Fluent
|
|
697
697
|
actual_log_path = @log_path
|
698
698
|
|
699
699
|
# We need to prepare a unique path for each worker since Windows locks files.
|
700
|
-
if Fluent.windows? && rotate
|
700
|
+
if Fluent.windows? && rotate && @log_path && @log_path != "-"
|
701
701
|
actual_log_path = Fluent::Log.per_process_path(@log_path, process_type, worker_id)
|
702
702
|
end
|
703
703
|
|
data/lib/fluent/system_config.rb
CHANGED
data/lib/fluent/version.rb
CHANGED
@@ -151,7 +151,7 @@ module Fluent::Config
|
|
151
151
|
data('daily' => "daily",
|
152
152
|
'weekly' => 'weekly',
|
153
153
|
'monthly' => 'monthly')
|
154
|
-
test "
|
154
|
+
test "strings for rotate_age" do |age|
|
155
155
|
conf = parse_text(<<-EOS)
|
156
156
|
<system>
|
157
157
|
<log>
|
@@ -160,7 +160,7 @@ module Fluent::Config
|
|
160
160
|
</system>
|
161
161
|
EOS
|
162
162
|
sc = Fluent::SystemConfig.new(conf)
|
163
|
-
assert_equal(age
|
163
|
+
assert_equal(age, sc.log.rotate_age)
|
164
164
|
end
|
165
165
|
|
166
166
|
test "numeric number for rotate age" do
|
@@ -26,6 +26,10 @@ class IntailPositionFileTest < Test::Unit::TestCase
|
|
26
26
|
"valid_path" => Fluent::Plugin::TailInput::TargetInfo.new("valid_path", 1),
|
27
27
|
"inode23bit" => Fluent::Plugin::TailInput::TargetInfo.new("inode23bit", 0),
|
28
28
|
}
|
29
|
+
TEST_CONTENT_INODES = {
|
30
|
+
1 => Fluent::Plugin::TailInput::TargetInfo.new("valid_path", 1),
|
31
|
+
0 => Fluent::Plugin::TailInput::TargetInfo.new("inode23bit", 0),
|
32
|
+
}
|
29
33
|
|
30
34
|
def write_data(f, content)
|
31
35
|
f.write(content)
|
@@ -221,7 +225,7 @@ class IntailPositionFileTest < Test::Unit::TestCase
|
|
221
225
|
end
|
222
226
|
|
223
227
|
sub_test_case '#unwatch' do
|
224
|
-
test '
|
228
|
+
test 'unwatch entry by path' do
|
225
229
|
write_data(@file, TEST_CONTENT)
|
226
230
|
pf = Fluent::Plugin::TailInput::PositionFile.load(@file, false, {}, logger: $log)
|
227
231
|
inode1 = File.stat(@file).ino
|
@@ -239,6 +243,32 @@ class IntailPositionFileTest < Test::Unit::TestCase
|
|
239
243
|
|
240
244
|
assert_not_equal p1, p2
|
241
245
|
end
|
246
|
+
|
247
|
+
test 'unwatch entries by inode' do
|
248
|
+
write_data(@file, TEST_CONTENT)
|
249
|
+
pf = Fluent::Plugin::TailInput::PositionFile.load(@file, true, TEST_CONTENT_INODES, logger: $log)
|
250
|
+
|
251
|
+
existing_targets = TEST_CONTENT_INODES.select do |inode, target_info|
|
252
|
+
inode == 1
|
253
|
+
end
|
254
|
+
pe_to_unwatch = pf[TEST_CONTENT_INODES[0]]
|
255
|
+
|
256
|
+
pf.unwatch_removed_targets(existing_targets)
|
257
|
+
|
258
|
+
assert_equal(
|
259
|
+
{
|
260
|
+
map_keys: [TEST_CONTENT_INODES[1].ino],
|
261
|
+
unwatched_pe_pos: Fluent::Plugin::TailInput::PositionFile::UNWATCHED_POSITION,
|
262
|
+
},
|
263
|
+
{
|
264
|
+
map_keys: pf.instance_variable_get(:@map).keys,
|
265
|
+
unwatched_pe_pos: pe_to_unwatch.read_pos,
|
266
|
+
}
|
267
|
+
)
|
268
|
+
|
269
|
+
unwatched_pe_retaken = pf[TEST_CONTENT_INODES[0]]
|
270
|
+
assert_not_equal pe_to_unwatch, unwatched_pe_retaken
|
271
|
+
end
|
242
272
|
end
|
243
273
|
|
244
274
|
sub_test_case 'FilePositionEntry' do
|
data/test/plugin/test_base.rb
CHANGED
@@ -108,7 +108,7 @@ class BaseTest < Test::Unit::TestCase
|
|
108
108
|
@p.extend m
|
109
109
|
assert_equal [], logger.logs
|
110
110
|
|
111
|
-
ret = @p.string_safe_encoding("abc\xff.\x01f"){|s| s.split(
|
111
|
+
ret = @p.string_safe_encoding("abc\xff.\x01f"){|s| s.split(".") }
|
112
112
|
assert_equal ['abc?', "\u0001f"], ret
|
113
113
|
assert_equal 1, logger.logs.size
|
114
114
|
assert{ logger.logs.first.include?("invalid byte sequence is replaced in ") }
|
@@ -57,6 +57,17 @@ class BufferChunkTest < Test::Unit::TestCase
|
|
57
57
|
assert chunk.respond_to?(:msgpack_each)
|
58
58
|
end
|
59
59
|
|
60
|
+
test 'unpacker arg is not implemented for ChunkMessagePackEventStreamer' do
|
61
|
+
meta = Object.new
|
62
|
+
chunk = Fluent::Plugin::Buffer::Chunk.new(meta)
|
63
|
+
chunk.extend Fluent::ChunkMessagePackEventStreamer
|
64
|
+
|
65
|
+
unpacker = Fluent::MessagePackFactory.thread_local_msgpack_unpacker
|
66
|
+
|
67
|
+
assert_raise(NotImplementedError){ chunk.each(unpacker: unpacker) }
|
68
|
+
assert_raise(NotImplementedError){ chunk.msgpack_each(unpacker: unpacker) }
|
69
|
+
end
|
70
|
+
|
60
71
|
test 'some methods raise ArgumentError with an option of `compressed: :gzip` and without extending Compressble`' do
|
61
72
|
meta = Object.new
|
62
73
|
chunk = Fluent::Plugin::Buffer::Chunk.new(meta)
|
@@ -367,7 +367,7 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
367
367
|
end
|
368
368
|
|
369
369
|
logs = d.instance.log.out.logs
|
370
|
-
assert{ logs.
|
370
|
+
assert{ logs.count{|line| line =~ /skip invalid event/ } == 2 }
|
371
371
|
|
372
372
|
d.instance_shutdown
|
373
373
|
end
|
@@ -593,10 +593,10 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
593
593
|
|
594
594
|
# check log
|
595
595
|
logs = d.instance.log.logs
|
596
|
-
assert_equal 1, logs.
|
596
|
+
assert_equal 1, logs.count{|line|
|
597
597
|
line =~ / \[warn\]: Input chunk size is larger than 'chunk_size_warn_limit':/ &&
|
598
598
|
line =~ / tag="test.tag" host="#{LOCALHOST_HOSTNAME}" limit=16777216 size=16777501/
|
599
|
-
}
|
599
|
+
}, "large chunk warning is not logged"
|
600
600
|
|
601
601
|
d.instance_shutdown
|
602
602
|
end
|
@@ -619,10 +619,10 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
619
619
|
|
620
620
|
# check log
|
621
621
|
logs = d.instance.log.logs
|
622
|
-
assert_equal 1, logs.
|
622
|
+
assert_equal 1, logs.count{ |line|
|
623
623
|
line =~ / \[warn\]: Input chunk size is larger than 'chunk_size_warn_limit':/ &&
|
624
624
|
line =~ / tag="test.tag" host="#{LOCALHOST_HOSTNAME}" limit=16777216 size=16777501/
|
625
|
-
}
|
625
|
+
}, "large chunk warning is not logged"
|
626
626
|
|
627
627
|
d.instance_shutdown
|
628
628
|
end
|
@@ -653,10 +653,10 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
653
653
|
|
654
654
|
# check log
|
655
655
|
logs = d.instance.log.logs
|
656
|
-
assert_equal 1, logs.
|
656
|
+
assert_equal 1, logs.count{|line|
|
657
657
|
line =~ / \[warn\]: Input chunk size is larger than 'chunk_size_limit', dropped:/ &&
|
658
658
|
line =~ / tag="test.tag" host="#{LOCALHOST_HOSTNAME}" limit=33554432 size=33554989/
|
659
|
-
}
|
659
|
+
}, "large chunk warning is not logged"
|
660
660
|
|
661
661
|
d.instance_shutdown
|
662
662
|
end
|
@@ -676,9 +676,9 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
676
676
|
|
677
677
|
# check log
|
678
678
|
logs = d.instance.log.logs
|
679
|
-
assert_equal 1, logs.
|
679
|
+
assert_equal 1, logs.count{|line|
|
680
680
|
line =~ / \[warn\]: incoming chunk is broken: host="#{LOCALHOST_HOSTNAME}" msg=#{data.inspect}/
|
681
|
-
}
|
681
|
+
}, "should not accept broken chunk"
|
682
682
|
|
683
683
|
d.instance_shutdown
|
684
684
|
end
|