fluentd 0.12.40 → 0.12.41

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
  SHA1:
3
- metadata.gz: 524485c147140fc4851fdaeab2ac208ae866363a
4
- data.tar.gz: ba754459fd69e611c6930c0ac6307e47474d2503
3
+ metadata.gz: 0ec31bae71a398df42247c0d91a55f5575fe1623
4
+ data.tar.gz: 20c905e78d4d66f7c69c94be932dac503644e7f0
5
5
  SHA512:
6
- metadata.gz: 722511c8f2827a6a68d4500ffe49ad761886738caed8a4823737b5d162b4cbefaeed4ecce216b144db07f9392df9b2bf4ef40cb1d24a7e750187a58ca6c57af8
7
- data.tar.gz: 11eb85ece55f56692e2ecaea32eb881b9abf9d34c5b6d76358833eb5936a395e0dd080daaea9fa990c95e1b3f4bdf5bd5fbfd1aebb0ff2aac35a29bcd4f43449
6
+ metadata.gz: de3317a3a936c3432cadd2f39fda59918ec509eb19f0dd99da0d806a9dacedff35aa52af816b6a05a01e5ba207f27a2510cfc3e9738566226a96f3513ead97e3
7
+ data.tar.gz: ed3ea856639b975f67679fe2e7a6015cf6072d2d8edee017e5765424713dc3c85ef1660d56dc792d98ba970583f9b7d6f9e6db5f876f5cc7356a814ec02bc2df
@@ -1,5 +1,23 @@
1
1
  # v0.12
2
2
 
3
+ ## Release 0.12.41 - 2017/11/15
4
+
5
+ ### New features / Enhancements
6
+
7
+ * in_udp: Add remove_newline parameter
8
+ https://github.com/fluent/fluentd/pull/1748
9
+
10
+ ### Bug fixes
11
+
12
+ * out_forward: Fix elapsed time miscalculation in tcp heartbeat
13
+ https://github.com/fluent/fluentd/pull/1738
14
+ * in_tail: Skip setup failed watcher to avoid resource leak and log bloat
15
+ https://github.com/fluent/fluentd/pull/1752
16
+ * agent: Add error location to emit error logs
17
+ https://github.com/fluent/fluentd/pull/1746
18
+ * filter_parser: Fix dumpped result for avoiding escape sequence injection
19
+ https://github.com/fluent/fluentd/pull/1733
20
+
3
21
  ## Release 0.12.40 - 2017/08/25
4
22
 
5
23
  ### Bug fixes
@@ -53,7 +53,7 @@ class Fluent::ParserFilter < Fluent::Filter
53
53
  if @emit_invalid_record_to_error
54
54
  router.emit_error_event(tag, time, record, ::Fluent::ParserError.new("pattern not match with data '#{raw_value}'"))
55
55
  else
56
- log.warn "pattern not match with data '#{raw_value}'" unless @suppress_parse_error_log
56
+ log.warn "pattern not match with data '#{raw_value.dump}'" unless @suppress_parse_error_log
57
57
  end
58
58
  if @reserve_data
59
59
  t = time
@@ -24,6 +24,16 @@ module Fluent
24
24
  class NewTailInput < Input
25
25
  Plugin.register_input('tail', self)
26
26
 
27
+ class WatcherSetupError < StandardError
28
+ def initialize(msg)
29
+ @message = msg
30
+ end
31
+
32
+ def to_s
33
+ @message
34
+ end
35
+ end
36
+
27
37
  def initialize
28
38
  super
29
39
  @paths = []
@@ -65,6 +75,8 @@ module Fluent
65
75
  config_param :skip_refresh_on_startup, :bool, default: false
66
76
  desc 'Ignore repeated permission error logs'
67
77
  config_param :ignore_repeated_permission_error, :bool, default: false
78
+ # This option is for Cool.io's loop wait timeout to avoid loop stuck at shutdown. Almost users don't need to change this value.
79
+ config_param :blocking_timeout, :time, default: 0.5
68
80
 
69
81
  attr_reader :paths
70
82
 
@@ -207,6 +219,9 @@ module Fluent
207
219
  tw = TailWatcher.new(path, @rotate_wait, pe, log, @read_from_head, @enable_watch_timer, @read_lines_limit, method(:update_watcher), line_buffer_timer_flusher, &method(:receive_lines))
208
220
  tw.attach(@loop)
209
221
  tw
222
+ rescue => e
223
+ tw.close if tw
224
+ raise e
210
225
  end
211
226
 
212
227
  def start_watchers(paths)
@@ -223,7 +238,13 @@ module Fluent
223
238
  end
224
239
  end
225
240
 
226
- @tails[path] = setup_watcher(path, pe)
241
+ begin
242
+ tw = setup_watcher(path, pe)
243
+ rescue WatcherSetupError => e
244
+ log.warn "Skip #{path} because unexpected setup error happens: #{e}"
245
+ next
246
+ end
247
+ @tails[path] = tw
227
248
  }
228
249
  end
229
250
 
@@ -292,7 +313,7 @@ module Fluent
292
313
  end
293
314
 
294
315
  def run
295
- @loop.run
316
+ @loop.run(@blocking_timeout)
296
317
  rescue
297
318
  log.error "unexpected error", error: $!.to_s
298
319
  log.error_backtrace
@@ -436,8 +457,8 @@ module Fluent
436
457
  end
437
458
 
438
459
  def detach
439
- @timer_trigger.detach if @enable_watch_timer && @timer_trigger.attached?
440
- @stat_trigger.detach if @stat_trigger.attached?
460
+ @timer_trigger.detach if @enable_watch_timer && @timer_trigger && @timer_trigger.attached?
461
+ @stat_trigger.detach if @stat_trigger && @stat_trigger.attached?
441
462
  end
442
463
 
443
464
  def close(close_io = true)
@@ -485,7 +506,12 @@ module Fluent
485
506
  pos = @read_from_head ? 0 : fsize
486
507
  @pe.update(inode, pos)
487
508
  end
488
- io.seek(pos)
509
+
510
+ begin
511
+ io.seek(pos)
512
+ rescue RangeError
513
+ raise WatcherSetupError, "seek error with #{@path}: file_position = #{pos.to_s(16)}"
514
+ end
489
515
 
490
516
  @io_handler = IOHandler.new(io, @pe, @log, @read_lines_limit, &method(:wrap_receive_lines))
491
517
  else
@@ -690,6 +716,9 @@ module Fluent
690
716
  @fsize = fsize
691
717
  end
692
718
 
719
+ rescue WatcherSetupError => e
720
+ io.close if io
721
+ raise e
693
722
  rescue
694
723
  @log.error $!.to_s
695
724
  @log.error_backtrace
@@ -26,6 +26,8 @@ module Fluent
26
26
  config_param :body_size_limit, :size, default: nil, deprecated: "use message_length_limit instead."
27
27
  desc "The max bytes of message"
28
28
  config_param :message_length_limit, :size, default: 4096
29
+ desc "Remove newline from the end of incoming payload"
30
+ config_param :remove_newline, :bool, default: true
29
31
 
30
32
  def configure(conf)
31
33
  super
@@ -37,7 +39,7 @@ module Fluent
37
39
  log.info "listening udp socket on #{@bind}:#{@port}"
38
40
  @usock = SocketUtil.create_udp_socket(@bind)
39
41
  @usock.bind(@bind, @port)
40
- SocketUtil::UdpHandler.new(@usock, log, @message_length_limit, callback, !!@source_hostname_key)
42
+ SocketUtil::UdpHandler.new(@usock, log, @message_length_limit, callback, !!@source_hostname_key, @remove_newline)
41
43
  end
42
44
  end
43
45
  end
@@ -394,9 +394,6 @@ module Fluent
394
394
  def on_timer
395
395
  return if @finished
396
396
  @nodes.each {|n|
397
- if n.tick
398
- rebuild_weight_array
399
- end
400
397
  begin
401
398
  #log.trace "sending heartbeat #{n.host}:#{n.port} on #{@heartbeat_type}"
402
399
  if @heartbeat_type == :tcp
@@ -408,6 +405,9 @@ module Fluent
408
405
  # TODO log
409
406
  log.debug "failed to send heartbeat packet to #{n.host}:#{n.port}", error: $!.to_s
410
407
  end
408
+ if n.tick
409
+ rebuild_weight_array
410
+ end
411
411
  }
412
412
  end
413
413
 
@@ -32,18 +32,19 @@ module Fluent
32
32
  module_function :create_udp_socket
33
33
 
34
34
  class UdpHandler < Coolio::IO
35
- def initialize(io, log, body_size_limit, callback, resolve_hostname = false)
35
+ def initialize(io, log, body_size_limit, callback, resolve_hostname = false, remove_newline = true)
36
36
  super(io)
37
37
  @io = io
38
38
  @io.do_not_reverse_lookup = !resolve_hostname
39
39
  @log = log
40
40
  @body_size_limit = body_size_limit
41
+ @remove_newline = remove_newline
41
42
  @callback = callback
42
43
  end
43
44
 
44
45
  def on_readable
45
46
  msg, addr = @io.recvfrom_nonblock(@body_size_limit)
46
- msg.chomp!
47
+ msg.chomp! if @remove_newline
47
48
  @callback.call(msg, addr)
48
49
  rescue => e
49
50
  @log.error "unexpected error", error: e, error_class: e.class
@@ -177,7 +177,7 @@ module Fluent
177
177
  end
178
178
 
179
179
  def emit_error_event(tag, time, record, error)
180
- error_info = {error_class: error.class, error: error.to_s, tag: tag, time: time}
180
+ error_info = {error_class: error.class, error: error.to_s, location: (error.backtrace ? error.backtrace.first : nil), tag: tag, time: time}
181
181
  if @error_collector
182
182
  # A record is not included in the logs because <@ERROR> handles it. This warn is for the notification
183
183
  log.warn "send an error event to @ERROR:", error_info
@@ -189,7 +189,7 @@ module Fluent
189
189
  end
190
190
 
191
191
  def handle_emits_error(tag, es, error)
192
- error_info = {error_class: error.class, error: error.to_s, tag: tag}
192
+ error_info = {error_class: error.class, error: error.to_s, location: (error.backtrace ? error.backtrace.first : nil), tag: tag}
193
193
  if @error_collector
194
194
  log.warn "send an error event stream to @ERROR:", error_info
195
195
  @error_collector.emit_stream(tag, es)
@@ -218,7 +218,7 @@ module Fluent
218
218
  end
219
219
 
220
220
  def emit_error_event(tag, time, record, error)
221
- error_info = {error_class: error.class, error: error.to_s, tag: tag, time: time, record: record}
221
+ error_info = {error_class: error.class, error: error.to_s, location: (error.backtrace ? error.backtrace.first : nil), tag: tag, time: time, record: record}
222
222
  log.warn "dump an error event in @ERROR:", error_info
223
223
  end
224
224
 
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Fluent
18
18
 
19
- VERSION = '0.12.40'
19
+ VERSION = '0.12.41'
20
20
 
21
21
  end
@@ -104,6 +104,26 @@ class UdpInputTest < Test::Unit::TestCase
104
104
  end
105
105
  }
106
106
 
107
+ test "remove_newline" do
108
+ tests = [{'msg' => "test1\n", 'expected' => "test1\n"},
109
+ {'msg' => "test2\n", 'expected' => "test2\n"}]
110
+
111
+ d = create_driver(BASE_CONFIG + %!
112
+ format none
113
+ remove_newline false
114
+ !)
115
+ d.run do
116
+ u = UDPSocket.new
117
+ u.connect('127.0.0.1', PORT)
118
+ tests.each { |test|
119
+ u.send(test['msg'], 0)
120
+ }
121
+ sleep 1
122
+ end
123
+
124
+ compare_test_result(d.emits, tests)
125
+ end
126
+
107
127
  def compare_test_result(emits, tests)
108
128
  assert_equal(2, emits.size)
109
129
  emits.each_index {|i|
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: 0.12.40
4
+ version: 0.12.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-25 00:00:00.000000000 Z
11
+ date: 2017-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -301,9 +301,9 @@ files:
301
301
  - ".gitignore"
302
302
  - ".travis.yml"
303
303
  - AUTHORS
304
+ - CHANGELOG.md
304
305
  - CONTRIBUTING.md
305
306
  - COPYING
306
- - ChangeLog
307
307
  - Gemfile
308
308
  - README.md
309
309
  - Rakefile
@@ -496,7 +496,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
496
496
  version: '0'
497
497
  requirements: []
498
498
  rubyforge_project:
499
- rubygems_version: 2.6.11
499
+ rubygems_version: 2.6.13
500
500
  signing_key:
501
501
  specification_version: 4
502
502
  summary: Fluentd event collector