fluentd 1.11.2 → 1.11.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f6935bfa737b73c4be0d7bb1c5a689b644c2044da43386db71460b174bbf409
4
- data.tar.gz: 9144f8027f0d372c99ecbf8059c29fb6efb8cb780d7d4dcafcbf33de5822b22d
3
+ metadata.gz: 9fac73611b9d1c9b470912f6de8294795e5e8809d1730fa9f692aae4777ffdc2
4
+ data.tar.gz: 88c9fe2ccf19fa1a1e82924072182ed7c0c688e70f25dcdff8245d386644faee
5
5
  SHA512:
6
- metadata.gz: 23612a8c3dd10c3e2b7b32bba4169f063eed5b50ba1c33f9fbf298fe4846eedfbc5605fb216ecaf1aff27f36c6852e8e3f9957a4a191106f27b1caf955364467
7
- data.tar.gz: fa945c1f5c57d2ddc35109f5b10aca233fe4268970765dce1dd5e5798457942062cdd803a82317a968df5d1d11835da46a97eb8e8824f4d08979728c6693ac85
6
+ metadata.gz: d8ee0bff2c2fb43bd8cbcf727de8cf31ab885ecd4e4eae299c2588559d665a4c309a8b575cedadd6534a51962934d6f643eda5baa6056759345814fb1ab084ee
7
+ data.tar.gz: 40c86faa9b747e65e32ffa004f5f1e8b5563fb81f5d686174da99866ad0c8789d91d465e78d5e4fff891359b05a71db4e204f2f91eed737c6cc5804999644ab7
@@ -1,5 +1,28 @@
1
1
  # v1.11
2
2
 
3
+ ## Release v1.11.3 - 2020/09/30
4
+
5
+ ### Enhancement
6
+
7
+ * in_exec: Add `connect_mode` parameter to read stderr
8
+ https://github.com/fluent/fluentd/pull/3108
9
+ * parser_json: Improve the performance
10
+ https://github.com/fluent/fluentd/pull/3109
11
+ * log: Add `ignore_same_log_interval` parameter
12
+ https://github.com/fluent/fluentd/pull/3119
13
+ * Upgrade win32 gems
14
+ https://github.com/fluent/fluentd/pull/3100
15
+ * Refactoring code
16
+ https://github.com/fluent/fluentd/pull/3094
17
+ https://github.com/fluent/fluentd/pull/3118
18
+
19
+ ### Bug fix
20
+
21
+ * buffer: Fix calculation of timekey stats
22
+ https://github.com/fluent/fluentd/pull/3018
23
+ * buffer: fix binmode usage for prevent gc
24
+ https://github.com/fluent/fluentd/pull/3138
25
+
3
26
  ## Release v1.11.2 - 2020/08/04
4
27
 
5
28
  ### Enhancement
@@ -32,11 +32,11 @@ Gem::Specification.new do |gem|
32
32
  fake_platform = ENV['GEM_BUILD_FAKE_PLATFORM'].to_s
33
33
  gem.platform = fake_platform unless fake_platform.empty?
34
34
  if /mswin|mingw/ =~ fake_platform || (/mswin|mingw/ =~ RUBY_PLATFORM && fake_platform.empty?)
35
- gem.add_runtime_dependency("win32-service", ["~> 0.8.3"])
36
- gem.add_runtime_dependency("win32-ipc", ["~> 0.6.1"])
37
- gem.add_runtime_dependency("win32-event", ["~> 0.6.1"])
38
- gem.add_runtime_dependency("windows-pr", ["~> 1.2.5"])
39
- gem.add_runtime_dependency("certstore_c", ["~> 0.1.2"])
35
+ gem.add_runtime_dependency("win32-service", ["~> 2.1.5"])
36
+ gem.add_runtime_dependency("win32-ipc", ["~> 0.7.0"])
37
+ gem.add_runtime_dependency("win32-event", ["~> 0.6.3"])
38
+ gem.add_runtime_dependency("windows-pr", ["~> 1.2.6"])
39
+ gem.add_runtime_dependency("certstore_c", ["~> 0.1.7"])
40
40
  end
41
41
 
42
42
  gem.add_development_dependency("rake", ["~> 13.0"])
@@ -113,6 +113,7 @@ module Fluent
113
113
 
114
114
  @suppress_repeated_stacktrace = opts[:suppress_repeated_stacktrace]
115
115
  @ignore_repeated_log_interval = opts[:ignore_repeated_log_interval]
116
+ @ignore_same_log_interval = opts[:ignore_same_log_interval]
116
117
 
117
118
  @process_type = opts[:process_type] # :supervisor, :worker0, :workers Or :standalone
118
119
  @process_type ||= :standalone # to keep behavior of existing code
@@ -141,7 +142,8 @@ module Fluent
141
142
  dl_opts[:log_level] = @level - 1
142
143
  logger = ServerEngine::DaemonLogger.new(@out, dl_opts)
143
144
  clone = self.class.new(logger, suppress_repeated_stacktrace: @suppress_repeated_stacktrace, process_type: @process_type,
144
- worker_id: @worker_id, ignore_repeated_log_interval: @ignore_repeated_log_interval)
145
+ worker_id: @worker_id, ignore_repeated_log_interval: @ignore_repeated_log_interval,
146
+ ignore_same_log_interval: @ignore_same_log_interval)
145
147
  clone.format = @format
146
148
  clone.time_format = @time_format
147
149
  clone.log_event_enabled = @log_event_enabled
@@ -151,7 +153,7 @@ module Fluent
151
153
 
152
154
  attr_reader :format
153
155
  attr_reader :time_format
154
- attr_accessor :log_event_enabled, :ignore_repeated_log_interval
156
+ attr_accessor :log_event_enabled, :ignore_repeated_log_interval, :ignore_same_log_interval
155
157
  attr_accessor :out
156
158
  attr_accessor :level
157
159
  attr_accessor :optional_header, :optional_attrs
@@ -428,6 +430,27 @@ module Fluent
428
430
  (cached_log.msg == message) && (time - cached_log.time <= @ignore_repeated_log_interval)
429
431
  end
430
432
 
433
+ def ignore_same_log?(time, message)
434
+ cached_log = Thread.current[:last_same_log]
435
+ if cached_log.nil?
436
+ Thread.current[:last_same_log] = {message => time}
437
+ return false
438
+ end
439
+
440
+ prev_time = cached_log[message]
441
+ if prev_time
442
+ if (time - prev_time) <= @ignore_same_log_interval
443
+ true
444
+ else
445
+ cached_log[message] = time
446
+ false
447
+ end
448
+ else
449
+ cached_log[message] = time
450
+ false
451
+ end
452
+ end
453
+
431
454
  def suppress_stacktrace?(backtrace)
432
455
  cached_log = Thread.current[:last_repeated_stacktrace]
433
456
  return false if cached_log.nil?
@@ -507,7 +530,11 @@ module Fluent
507
530
  end
508
531
  }
509
532
 
510
- if @ignore_repeated_log_interval
533
+ if @ignore_same_log_interval
534
+ if ignore_same_log?(time, message)
535
+ return nil, nil
536
+ end
537
+ elsif @ignore_repeated_log_interval
511
538
  if ignore_repeated_log?(:last_repeated_log, time, message)
512
539
  return nil, nil
513
540
  else
@@ -569,6 +596,9 @@ module Fluent
569
596
  if logger.instance_variable_defined?(:@ignore_repeated_log_interval)
570
597
  @ignore_repeated_log_interval = logger.instance_variable_get(:@ignore_repeated_log_interval)
571
598
  end
599
+ if logger.instance_variable_defined?(:@ignore_same_log_interval)
600
+ @ignore_same_log_interval = logger.instance_variable_get(:@ignore_same_log_interval)
601
+ end
572
602
 
573
603
  self.format = @logger.format
574
604
  self.time_format = @logger.time_format
@@ -192,6 +192,7 @@ module Fluent
192
192
 
193
193
  @stage_size = @queue_size = 0
194
194
  @timekeys = Hash.new(0)
195
+ @enable_update_timekeys = false
195
196
  @mutex = Mutex.new
196
197
  end
197
198
 
@@ -207,24 +208,23 @@ module Fluent
207
208
  end
208
209
  end
209
210
 
211
+ def enable_update_timekeys
212
+ @enable_update_timekeys = true
213
+ end
214
+
210
215
  def start
211
216
  super
212
217
 
213
218
  @stage, @queue = resume
214
219
  @stage.each_pair do |metadata, chunk|
215
220
  @stage_size += chunk.bytesize
216
- if chunk.metadata && chunk.metadata.timekey
217
- add_timekey(metadata.timekey)
218
- end
219
221
  end
220
222
  @queue.each do |chunk|
221
223
  @queued_num[chunk.metadata] ||= 0
222
224
  @queued_num[chunk.metadata] += 1
223
225
  @queue_size += chunk.bytesize
224
- if chunk.metadata && chunk.metadata.timekey
225
- add_timekey(chunk.metadata.timekey)
226
- end
227
226
  end
227
+ update_timekeys
228
228
  log.debug "buffer started", instance: self.object_id, stage_size: @stage_size, queue_size: @queue_size
229
229
  end
230
230
 
@@ -273,12 +273,9 @@ module Fluent
273
273
  Metadata.new(timekey, tag, variables)
274
274
  end
275
275
 
276
+ # Keep this method for existing code
276
277
  def metadata(timekey: nil, tag: nil, variables: nil)
277
- meta = Metadata.new(timekey, tag, variables)
278
- if (t = meta.timekey)
279
- add_timekey(t)
280
- end
281
- meta
278
+ Metadata.new(timekey, tag, variables)
282
279
  end
283
280
 
284
281
  def timekeys
@@ -472,9 +469,23 @@ module Fluent
472
469
  end
473
470
  end
474
471
 
472
+ def update_timekeys
473
+ synchronize do
474
+ chunks = @stage.values
475
+ chunks.concat(@queue)
476
+ @timekeys = chunks.each_with_object({}) do |chunk, keys|
477
+ if chunk.metadata && chunk.metadata.timekey
478
+ t = chunk.metadata.timekey
479
+ keys[t] = keys.fetch(t, 0) + 1
480
+ end
481
+ end
482
+ end
483
+ end
484
+
475
485
  # At flush_at_shutdown, all staged chunks should be enqueued for buffer flush. Set true to force_enqueue for it.
476
486
  def enqueue_all(force_enqueue = false)
477
487
  log.on_trace { log.trace "enqueueing all chunks in buffer", instance: self.object_id }
488
+ update_timekeys if @enable_update_timekeys
478
489
 
479
490
  if block_given?
480
491
  synchronize{ @stage.keys }.each do |metadata|
@@ -553,10 +564,6 @@ module Fluent
553
564
  log.trace "chunk purged", instance: self.object_id, chunk_id: dump_unique_id_hex(chunk_id), metadata: metadata
554
565
  end
555
566
 
556
- if metadata && metadata.timekey
557
- del_timekey(metadata.timekey)
558
- end
559
-
560
567
  nil
561
568
  end
562
569
 
@@ -788,11 +795,11 @@ module Fluent
788
795
  'total_queued_size' => stage_size + queue_size,
789
796
  }
790
797
 
791
- if (m = timekeys.min)
798
+ tkeys = timekeys
799
+ if (m = tkeys.min)
792
800
  stats['oldest_timekey'] = m
793
801
  end
794
-
795
- if (m = timekeys.max)
802
+ if (m = tkeys.max)
796
803
  stats['newest_timekey'] = m
797
804
  end
798
805
 
@@ -809,24 +816,6 @@ module Fluent
809
816
  !@queue.empty?
810
817
  end
811
818
  end
812
-
813
- def add_timekey(t)
814
- @mutex.synchronize do
815
- @timekeys[t] += 1
816
- end
817
- nil
818
- end
819
-
820
- def del_timekey(t)
821
- @mutex.synchronize do
822
- if @timekeys[t] <= 1
823
- @timekeys.delete(t)
824
- else
825
- @timekeys[t] -= 1
826
- end
827
- end
828
- nil
829
- end
830
819
  end
831
820
  end
832
821
  end
@@ -206,8 +206,9 @@ module Fluent
206
206
  output_io = if chunk_io.is_a?(StringIO)
207
207
  StringIO.new
208
208
  else
209
- Tempfile.new('decompressed-data').binmode
209
+ Tempfile.new('decompressed-data')
210
210
  end
211
+ output_io.binmode if output_io.is_a?(Tempfile)
211
212
  decompress(input_io: chunk_io, output_io: output_io)
212
213
  output_io.seek(0, IO::SEEK_SET)
213
214
  yield output_io
@@ -25,6 +25,8 @@ module Fluent::Plugin
25
25
 
26
26
  desc 'The command (program) to execute.'
27
27
  config_param :command, :string
28
+ desc 'Specify connect mode to executed process'
29
+ config_param :connect_mode, :enum, list: [:read, :read_with_stderr], default: :read
28
30
 
29
31
  config_section :parse do
30
32
  config_set_default :@type, 'tsv'
@@ -72,9 +74,9 @@ module Fluent::Plugin
72
74
  super
73
75
 
74
76
  if @run_interval
75
- child_process_execute(:exec_input, @command, interval: @run_interval, mode: [:read], &method(:run))
77
+ child_process_execute(:exec_input, @command, interval: @run_interval, mode: [@connect_mode], &method(:run))
76
78
  else
77
- child_process_execute(:exec_input, @command, immediate: true, mode: [:read], &method(:run))
79
+ child_process_execute(:exec_input, @command, immediate: true, mode: [@connect_mode], &method(:run))
78
80
  end
79
81
  end
80
82
 
@@ -340,6 +340,7 @@ module Fluent
340
340
  buffer_conf = conf.elements(name: 'buffer').first || Fluent::Config::Element.new('buffer', '', {}, [])
341
341
  @buffer = Plugin.new_buffer(buffer_type, parent: self)
342
342
  @buffer.configure(buffer_conf)
343
+ @buffer.enable_update_timekeys if @chunk_key_time
343
344
 
344
345
  @flush_at_shutdown = @buffer_config.flush_at_shutdown
345
346
  if @flush_at_shutdown.nil?
@@ -71,8 +71,11 @@ module Fluent
71
71
  end
72
72
 
73
73
  def parse(text)
74
- r = @load_proc.call(text)
75
- time, record = convert_values(parse_time(r), r)
74
+ record = @load_proc.call(text)
75
+ time = parse_time(record)
76
+ if @execute_convert_values
77
+ time, record = convert_values(time, record)
78
+ end
76
79
  yield time, record
77
80
  rescue @error_class, EncodingError # EncodingError is for oj 3.x or later
78
81
  yield nil, nil
@@ -302,6 +302,7 @@ module Fluent
302
302
  log_level = params['log_level']
303
303
  suppress_repeated_stacktrace = params['suppress_repeated_stacktrace']
304
304
  ignore_repeated_log_interval = params['ignore_repeated_log_interval']
305
+ ignore_same_log_interval = params['ignore_same_log_interval']
305
306
 
306
307
  log_path = params['log_path']
307
308
  chuser = params['chuser']
@@ -309,7 +310,8 @@ module Fluent
309
310
  log_rotate_age = params['log_rotate_age']
310
311
  log_rotate_size = params['log_rotate_size']
311
312
 
312
- log_opts = {suppress_repeated_stacktrace: suppress_repeated_stacktrace, ignore_repeated_log_interval: ignore_repeated_log_interval}
313
+ log_opts = {suppress_repeated_stacktrace: suppress_repeated_stacktrace, ignore_repeated_log_interval: ignore_repeated_log_interval,
314
+ ignore_same_log_interval: ignore_same_log_interval}
313
315
  logger_initializer = Supervisor::LoggerInitializer.new(
314
316
  log_path, log_level, chuser, chgroup, log_opts,
315
317
  log_rotate_age: log_rotate_age,
@@ -347,6 +349,7 @@ module Fluent
347
349
  chumask: 0,
348
350
  suppress_repeated_stacktrace: suppress_repeated_stacktrace,
349
351
  ignore_repeated_log_interval: ignore_repeated_log_interval,
352
+ ignore_same_log_interval: ignore_same_log_interval,
350
353
  daemonize: daemonize,
351
354
  rpc_endpoint: params['rpc_endpoint'],
352
355
  counter_server: params['counter_server'],
@@ -441,10 +444,11 @@ module Fluent
441
444
  self
442
445
  end
443
446
 
444
- def apply_options(format: nil, time_format: nil, log_dir_perm: nil, ignore_repeated_log_interval: nil)
447
+ def apply_options(format: nil, time_format: nil, log_dir_perm: nil, ignore_repeated_log_interval: nil, ignore_same_log_interval: nil)
445
448
  $log.format = format if format
446
449
  $log.time_format = time_format if time_format
447
450
  $log.ignore_repeated_log_interval = ignore_repeated_log_interval if ignore_repeated_log_interval
451
+ $log.ignore_same_log_interval = ignore_same_log_interval if ignore_same_log_interval
448
452
 
449
453
  if @path && log_dir_perm
450
454
  File.chmod(log_dir_perm || 0755, File.dirname(@path))
@@ -511,7 +515,8 @@ module Fluent
511
515
  @cl_opt = opt
512
516
  @conf = nil
513
517
 
514
- log_opts = {suppress_repeated_stacktrace: opt[:suppress_repeated_stacktrace], ignore_repeated_log_interval: opt[:ignore_repeated_log_interval]}
518
+ log_opts = {suppress_repeated_stacktrace: opt[:suppress_repeated_stacktrace], ignore_repeated_log_interval: opt[:ignore_repeated_log_interval],
519
+ ignore_same_log_interval: opt[:ignore_same_log_interval]}
515
520
  @log = LoggerInitializer.new(
516
521
  @log_path, opt[:log_level], @chuser, @chgroup, log_opts,
517
522
  log_rotate_age: @log_rotate_age,
@@ -635,7 +640,8 @@ module Fluent
635
640
  format: @system_config.log.format,
636
641
  time_format: @system_config.log.time_format,
637
642
  log_dir_perm: @system_config.dir_permission,
638
- ignore_repeated_log_interval: @system_config.ignore_repeated_log_interval
643
+ ignore_repeated_log_interval: @system_config.ignore_repeated_log_interval,
644
+ ignore_same_log_interval: @system_config.ignore_same_log_interval
639
645
  )
640
646
 
641
647
  $log.info :supervisor, 'parsing config file is succeeded', path: @config_path
@@ -24,7 +24,7 @@ module Fluent
24
24
  SYSTEM_CONFIG_PARAMETERS = [
25
25
  :workers, :root_dir, :log_level,
26
26
  :suppress_repeated_stacktrace, :emit_error_log_interval, :suppress_config_dump,
27
- :log_event_verbose, :ignore_repeated_log_interval,
27
+ :log_event_verbose, :ignore_repeated_log_interval, :ignore_same_log_interval,
28
28
  :without_source, :rpc_endpoint, :enable_get_dump, :process_name,
29
29
  :file_permission, :dir_permission, :counter_server, :counter_client,
30
30
  :strict_config_value, :enable_msgpack_time_support
@@ -35,6 +35,7 @@ module Fluent
35
35
  config_param :log_level, :enum, list: [:trace, :debug, :info, :warn, :error, :fatal], default: 'info'
36
36
  config_param :suppress_repeated_stacktrace, :bool, default: nil
37
37
  config_param :ignore_repeated_log_interval, :time, default: nil
38
+ config_param :ignore_same_log_interval, :time, default: nil
38
39
  config_param :emit_error_log_interval, :time, default: nil
39
40
  config_param :suppress_config_dump, :bool, default: nil
40
41
  config_param :log_event_verbose, :bool, default: nil
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Fluent
18
18
 
19
- VERSION = '1.11.2'
19
+ VERSION = '1.11.3'
20
20
 
21
21
  end
@@ -543,6 +543,8 @@ class BufferTest < Test::Unit::TestCase
543
543
  assert_equal [@dm0,@dm1,@dm1], @p.queue.map(&:metadata)
544
544
  assert_equal [@dm2,@dm3,m], @p.stage.keys
545
545
 
546
+ @p.update_timekeys
547
+
546
548
  assert @p.timekeys.include?(timekey)
547
549
  end
548
550
 
@@ -675,6 +677,8 @@ class BufferTest < Test::Unit::TestCase
675
677
  assert_equal [@dm2,@dm3,m], @p.stage.keys
676
678
  assert_equal 1, @p.stage[m].append_count
677
679
 
680
+ @p.update_timekeys
681
+
678
682
  assert @p.timekeys.include?(timekey)
679
683
  end
680
684
 
@@ -240,4 +240,22 @@ EOC
240
240
  assert_equal [tag, time, record], event
241
241
  }
242
242
  end
243
+
244
+ test 'emit error message with read_with_stderr' do
245
+ d = create_driver %[
246
+ tag test
247
+ command ruby #{File.join(File.dirname(SCRIPT_PATH), 'foo_bar_baz_no_existence.rb')}
248
+ connect_mode read_with_stderr
249
+ <parse>
250
+ @type none
251
+ </parse>
252
+ ]
253
+ d.run(expect_records: 1, timeout: 10)
254
+
255
+ assert{ d.events.length > 0 }
256
+ d.events.each do |event|
257
+ assert_equal 'test', event[0]
258
+ assert_match /LoadError/, event[2]['message']
259
+ end
260
+ end
243
261
  end
@@ -1403,6 +1403,9 @@ class TailInputTest < Test::Unit::TestCase
1403
1403
  end
1404
1404
 
1405
1405
  def test_tail_path_with_multiline_with_multiple_paths
1406
+ if ENV["APPVEYOR"] && Fluent.windows?
1407
+ omit "This testcase is unstable on AppVeyor."
1408
+ end
1406
1409
  files = ["#{TMP_DIR}/tail1.txt", "#{TMP_DIR}/tail2.txt"]
1407
1410
  files.each { |file| File.open(file, "wb") { |f| } }
1408
1411
 
@@ -278,6 +278,7 @@ class HttpHelperTest < Test::Unit::TestCase
278
278
  driver.http_server_create_https_server(:http_server_helper_test_tls, addr: '127.0.0.1', port: PORT, logger: NULL_LOGGER) do |s|
279
279
  s.get('/example/hello') { [200, { 'Content-Type' => 'text/plain' }, 'hello get'] }
280
280
  end
281
+ omit "TLS connection should be aborted due to `Errno::ECONNABORTED`. Need to debug." if Fluent.windows?
281
282
 
282
283
  resp = secure_get("https://127.0.0.1:#{PORT}/example/hello", verify: false)
283
284
  assert_equal('200', resp.code)
@@ -293,6 +294,8 @@ class HttpHelperTest < Test::Unit::TestCase
293
294
  'with passphrase' => ['apple', 'cert-pass.pem', 'cert-key-pass.pem'],
294
295
  'without passphrase' => [nil, 'cert.pem', 'cert-key.pem'])
295
296
  test 'load self-signed cert/key pair, verified from clients using cert files' do |(passphrase, cert, private_key)|
297
+ omit "Self signed certificate blocks TLS connection. Need to debug." if Fluent.windows?
298
+
296
299
  cert_path = File.join(CERT_DIR, cert)
297
300
  private_key_path = File.join(CERT_DIR, private_key)
298
301
  opt = { 'insecure' => 'false', 'private_key_path' => private_key_path, 'cert_path' => cert_path }
@@ -315,6 +318,8 @@ class HttpHelperTest < Test::Unit::TestCase
315
318
  'with passphrase' => ['apple', 'cert-pass.pem', 'cert-key-pass.pem', 'ca-cert-pass.pem'],
316
319
  'without passphrase' => [nil, 'cert.pem', 'cert-key.pem', 'ca-cert.pem'])
317
320
  test 'load cert by private CA cert file, verified from clients using CA cert file' do |(passphrase, cert, cert_key, ca_cert)|
321
+ omit "Self signed certificate blocks TLS connection. Need to debug." if Fluent.windows?
322
+
318
323
  cert_path = File.join(CERT_CA_DIR, cert)
319
324
  private_key_path = File.join(CERT_CA_DIR, cert_key)
320
325
 
@@ -411,6 +411,50 @@ class LogTest < Test::Unit::TestCase
411
411
  end
412
412
  end
413
413
 
414
+ sub_test_case "ignore_same_log_interval" do
415
+ teardown do
416
+ Thread.current[:last_same_log] = nil
417
+ end
418
+
419
+ def test_same_message
420
+ message = "This is test"
421
+ logger = ServerEngine::DaemonLogger.new(@log_device, {log_level: ServerEngine::DaemonLogger::INFO})
422
+ log = Fluent::Log.new(logger, {ignore_same_log_interval: 5})
423
+
424
+ log.error message
425
+ 10.times { |i|
426
+ Timecop.freeze(@timestamp + i + 1)
427
+ log.error message
428
+ }
429
+
430
+ expected = [
431
+ "2016-04-21 02:58:41 +0000 [error]: This is test\n",
432
+ "2016-04-21 02:58:47 +0000 [error]: This is test\n"
433
+ ]
434
+ assert_equal(expected, log.out.logs)
435
+ end
436
+
437
+ def test_different_message
438
+ message = "This is test"
439
+ logger = ServerEngine::DaemonLogger.new(@log_device, {log_level: ServerEngine::DaemonLogger::INFO})
440
+ log = Fluent::Log.new(logger, {ignore_same_log_interval: 10})
441
+
442
+ log.error message
443
+ 3.times { |i|
444
+ Timecop.freeze(@timestamp + i)
445
+ log.error message
446
+ log.error message
447
+ log.info "Hello! " + message
448
+ }
449
+
450
+ expected = [
451
+ "2016-04-21 02:58:41 +0000 [error]: This is test\n",
452
+ "2016-04-21 02:58:41 +0000 [info]: Hello! This is test\n",
453
+ ]
454
+ assert_equal(expected, log.out.logs)
455
+ end
456
+ end
457
+
414
458
  def test_dup
415
459
  dl_opts = {}
416
460
  dl_opts[:log_level] = ServerEngine::DaemonLogger::TRACE
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluentd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.2
4
+ version: 1.11.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-04 00:00:00.000000000 Z
11
+ date: 2020-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack