fluentd 1.2.0 → 1.2.1

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
- SHA1:
3
- metadata.gz: 784878757e32d7abd7c3bed9bcb4f081524502b0
4
- data.tar.gz: 89205de62e14d5b3210888a40656df87c6bc8d15
2
+ SHA256:
3
+ metadata.gz: ee967542a2be7009af606bfb3b78f0a8a9481d4649943e36cb6274629b235fde
4
+ data.tar.gz: ceba4cc28ba327a073df7520266570f5d59b43fb1bdb7952aa4c24297d4ce3ce
5
5
  SHA512:
6
- metadata.gz: fcbe5512f4ce1ffef0af5948dd4a6a1b81095f2d3032dee86692db4eb1164f13a2710786562980d2d44f3d289f9120d53c222b4ca796eae58fbc15e0354a657a
7
- data.tar.gz: 918b3cad26663a13c5ccba5e4fea2494124d793e5744e1c4e7e2b2d844a758638a3b78843e3718af7e1c95ee8420c60c06b469531dc0bba5151504817e970c64
6
+ metadata.gz: 0ac3ac045228b9d883c00248e44202f97975ea4ad320b868823e8fc15d0f68f1007012494777760fe3aff695290321776b54b25ed494ae00e190123e928f5f9e
7
+ data.tar.gz: f9360951581699824d0eef3646c34dac7b555555e1f578cb756605ca9fef8c2fe66c3443195e45d1ff57fae08e9d49c4c90d404b48c91d53494ff31181ba4feb
@@ -1,4 +1,23 @@
1
- # v1.1
1
+ # v1.2
2
+
3
+ ## Release v1.2.1 - 2018/05/23
4
+
5
+ ### Enhancements
6
+
7
+ * Counter: Add wait API to client
8
+ https://github.com/fluent/fluentd/pull/1997
9
+
10
+ ### Bug fixes
11
+
12
+ * in_tcp/in_udp: Fix source_hostname_key to set hostname correctly
13
+ https://github.com/fluent/fluentd/pull/1976
14
+ * in_monitor_agent: Fix buffer_total_queued_size calculation
15
+ https://github.com/fluent/fluentd/pull/1990
16
+ * out_file: Temporal fix for broken gzipped files with gzip and append
17
+ https://github.com/fluent/fluentd/pull/1995
18
+ * test: Fix unstable backup test
19
+ https://github.com/fluent/fluentd/pull/1979
20
+ * gemspec: Remove deprecated has_rdoc
2
21
 
3
22
  ## Release v1.2.0 - 2018/04/30
4
23
 
@@ -8,7 +27,7 @@
8
27
  https://github.com/fluent/fluentd/pull/1857
9
28
  * output: Backup for broken chunks
10
29
  https://github.com/fluent/fluentd/pull/1952
11
- * filter_grep: Support `<and>` and `<or>` support
30
+ * filter_grep: Support for `<and>` and `<or>` sections
12
31
  https://github.com/fluent/fluentd/pull/1897
13
32
  * config: Support `regexp` type in configuration parameter
14
33
  https://github.com/fluent/fluentd/pull/1927
@@ -28,6 +47,8 @@
28
47
  https://github.com/fluent/fluentd/pull/1942
29
48
  * output: Buffer chunk's unique id should be formatted as hex in the log
30
49
 
50
+ # v1.1
51
+
31
52
  ## Release v1.1.3 - 2018/04/03
32
53
 
33
54
  ### Enhancements
@@ -14,7 +14,6 @@ Gem::Specification.new do |gem|
14
14
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
15
15
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
16
16
  gem.require_paths = ["lib"]
17
- gem.has_rdoc = false
18
17
  gem.license = "Apache-2.0"
19
18
 
20
19
  gem.required_ruby_version = '>= 2.1'
@@ -16,6 +16,7 @@
16
16
 
17
17
  require 'cool.io'
18
18
  require 'fluent/counter/base_socket'
19
+ require 'fluent/counter/error'
19
20
  require 'timeout'
20
21
 
21
22
  module Fluent
@@ -59,7 +60,7 @@ module Fluent
59
60
  def establish(scope)
60
61
  scope = Timeout.timeout(@timeout) {
61
62
  response = send_request('establish', nil, [scope])
62
- raise response.errors.first if response.errors?
63
+ Fluent::Counter.raise_error(response.errors.first) if response.errors?
63
64
  data = response.data
64
65
  data.first
65
66
  }
@@ -274,6 +275,14 @@ module Fluent
274
275
  @result
275
276
  end
276
277
 
278
+ def wait
279
+ res = get
280
+ if res.error?
281
+ Fluent::Counter.raise_error(res.errors.first)
282
+ end
283
+ res
284
+ end
285
+
277
286
  private
278
287
 
279
288
  def join
@@ -61,5 +61,26 @@ module Fluent
61
61
  'internal_server_error'
62
62
  end
63
63
  end
64
+
65
+ def raise_error(response)
66
+ msg = response['message']
67
+ case response['code']
68
+ when 'invalid_params'
69
+ raise InvalidParams.new(msg)
70
+ when 'unknown_key'
71
+ raise UnknownKey.new(msg)
72
+ when 'parse_error'
73
+ raise ParseError.new(msg)
74
+ when 'invalid_request'
75
+ raise InvalidRequest.new(msg)
76
+ when 'method_not_found'
77
+ raise MethodNotFound.new(msg)
78
+ when 'internal_server_error'
79
+ raise InternalServerError.new(msg)
80
+ else
81
+ raise "Unknown code: #{response['code']}"
82
+ end
83
+ end
84
+ module_function :raise_error
64
85
  end
65
86
  end
@@ -279,7 +279,7 @@ module Fluent::Plugin
279
279
  MONITOR_INFO = {
280
280
  'output_plugin' => ->(){ is_a?(::Fluent::Plugin::Output) },
281
281
  'buffer_queue_length' => ->(){ throw(:skip) unless instance_variable_defined?(:@buffer) && !@buffer.nil? && @buffer.is_a?(::Fluent::Plugin::Buffer); @buffer.queue.size },
282
- 'buffer_total_queued_size' => ->(){ throw(:skip) unless instance_variable_defined?(:@buffer) && !@buffer.nil? && @buffer.is_a?(::Fluent::Plugin::Buffer); @buffer.stage_size },
282
+ 'buffer_total_queued_size' => ->(){ throw(:skip) unless instance_variable_defined?(:@buffer) && !@buffer.nil? && @buffer.is_a?(::Fluent::Plugin::Buffer); @buffer.stage_size + @buffer.queue_size },
283
283
  'retry_count' => ->(){ instance_variable_defined?(:@num_errors) ? @num_errors : nil },
284
284
  }
285
285
 
@@ -55,7 +55,7 @@ module Fluent::Plugin
55
55
  def start
56
56
  super
57
57
 
58
- server_create(:in_tcp_server, @port, bind: @bind) do |data, conn|
58
+ server_create(:in_tcp_server, @port, bind: @bind, resolve_name: !!@source_hostname_key) do |data, conn|
59
59
  conn.buffer << data
60
60
  begin
61
61
  pos = 0
@@ -63,7 +63,7 @@ module Fluent::Plugin
63
63
  super
64
64
 
65
65
  log.info "listening udp socket", bind: @bind, port: @port
66
- server_create(:in_udp_server, @port, proto: :udp, bind: @bind, max_bytes: @message_length_limit, receive_buffer_size: @receive_buffer_size) do |data, sock|
66
+ server_create(:in_udp_server, @port, proto: :udp, bind: @bind, resolve_name: !!@source_hostname_key, max_bytes: @message_length_limit, receive_buffer_size: @receive_buffer_size) do |data, sock|
67
67
  data.chomp! if @remove_newline
68
68
  begin
69
69
  @parser.parse(data) do |time, record|
@@ -17,6 +17,7 @@
17
17
  require 'fileutils'
18
18
  require 'zlib'
19
19
  require 'time'
20
+ require 'tempfile'
20
21
 
21
22
  require 'fluent/plugin/output'
22
23
  require 'fluent/config/error'
@@ -213,10 +214,28 @@ module Fluent::Plugin
213
214
  end
214
215
 
215
216
  def write_gzip_with_compression(path, chunk)
216
- File.open(path, "ab", @file_perm) do |f|
217
- gz = Zlib::GzipWriter.new(f)
218
- chunk.write_to(gz, compressed: :text)
219
- gz.close
217
+ if @append
218
+ # This code will be removed after zlib/multithread bug is fixed.
219
+ # Use Tempfile to avoid broken gzip files: https://github.com/fluent/fluentd/issues/1903
220
+ Tempfile.create('out_file-gzip-append') { |temp|
221
+ begin
222
+ writer = Zlib::GzipWriter.new(temp)
223
+ chunk.write_to(writer, compressed: :text)
224
+ ensure
225
+ writer.finish # avoid zlib finalizer warning
226
+ end
227
+ temp.rewind
228
+
229
+ File.open(path, "ab", @file_perm) do |f|
230
+ IO.copy_stream(temp, f)
231
+ end
232
+ }
233
+ else
234
+ File.open(path, "ab", @file_perm) do |f|
235
+ gz = Zlib::GzipWriter.new(f)
236
+ chunk.write_to(gz, compressed: :text)
237
+ gz.close
238
+ end
220
239
  end
221
240
  end
222
241
 
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Fluent
18
18
 
19
- VERSION = '1.2.0'
19
+ VERSION = '1.2.1'
20
20
 
21
21
  end
@@ -151,6 +151,10 @@ class CounterClientTest < ::Test::Unit::TestCase
151
151
 
152
152
  assert_empty response.data
153
153
  assert_equal expected_error, errors
154
+
155
+ assert_raise {
156
+ @client.init(param).wait
157
+ }
154
158
  end
155
159
 
156
160
  test 'return an existing value when passed key already exists and ignore option is true' do
@@ -455,7 +455,7 @@ plugin_id:test_filter\tplugin_category:filter\ttype:test_filter\toutput_plugin:f
455
455
  d.instance.start
456
456
  expected_test_out_fail_write_response = {
457
457
  "buffer_queue_length" => 1,
458
- "buffer_total_queued_size" => 0,
458
+ "buffer_total_queued_size" => 40,
459
459
  "output_plugin" => true,
460
460
  "plugin_category" => "output",
461
461
  "plugin_id" => "test_out_fail_write",
@@ -115,4 +115,25 @@ class TcpInputTest < Test::Unit::TestCase
115
115
  assert_equal expected_record, d.events[i][2]
116
116
  end
117
117
  end
118
+
119
+ test 'source_hostname_key' do
120
+ d = create_driver(BASE_CONFIG + %!
121
+ format none
122
+ source_hostname_key host
123
+ !)
124
+ hostname = nil
125
+ d.run(expect_records: 1) do
126
+ create_tcp_socket('127.0.0.1', PORT) do |sock|
127
+ sock.do_not_reverse_lookup = false
128
+ hostname = sock.peeraddr[2]
129
+ sock.send("test\n", 0)
130
+ end
131
+ end
132
+
133
+ assert_equal 1, d.events.size
134
+ event = d.events[0]
135
+ assert_equal "tcp", event[0]
136
+ assert event[1].is_a?(Fluent::EventTime)
137
+ assert_equal hostname, event[2]['host']
138
+ end
118
139
  end
@@ -31,6 +31,7 @@ class UdpInputTest < Test::Unit::TestCase
31
31
  else
32
32
  UDPSocket.new(Socket::AF_INET6)
33
33
  end
34
+ u.do_not_reverse_lookup = false
34
35
  u.connect(host, port)
35
36
  if block_given?
36
37
  begin
@@ -174,6 +175,26 @@ class UdpInputTest < Test::Unit::TestCase
174
175
  end
175
176
  end
176
177
 
178
+ test 'source_hostname_key' do
179
+ d = create_driver(BASE_CONFIG + %!
180
+ format none
181
+ source_hostname_key host
182
+ !)
183
+ hostname = nil
184
+ d.run(expect_records: 1) do
185
+ create_udp_socket('127.0.0.1', PORT) do |u|
186
+ u.send("test", 0)
187
+ hostname = u.peeraddr[2]
188
+ end
189
+ end
190
+
191
+ expected = {'message' => 'test'}
192
+ assert_equal 1, d.events.size
193
+ assert_equal "udp", d.events[0][0]
194
+ assert d.events[0][1].is_a?(Fluent::EventTime)
195
+ assert_equal hostname, d.events[0][2]['host']
196
+ end
197
+
177
198
  test 'receive_buffer_size' do
178
199
  # doesn't check exact value because it depends on platform and condition
179
200
 
@@ -169,6 +169,14 @@ class BufferedOutputBackupTest < Test::Unit::TestCase
169
169
  @i.flush_thread_wakeup
170
170
  end
171
171
 
172
+ def wait_flush(target_file)
173
+ waiting(5) {
174
+ target_dir = File.join(File.dirname(target_file), "*")
175
+ while Dir.glob(target_dir).size.zero?
176
+ end
177
+ }
178
+ end
179
+
172
180
  test 'backup chunk without secondary' do
173
181
  Fluent::SystemConfig.overwrite_system_config('root_dir' => TMP_DIR) do
174
182
  id = 'backup_test'
@@ -186,6 +194,7 @@ class BufferedOutputBackupTest < Test::Unit::TestCase
186
194
  flush_chunks
187
195
 
188
196
  target = "#{TMP_DIR}/backup/worker0/#{id}/#{@i.dump_unique_id_hex(chunk_id)}.log"
197
+ wait_flush(target)
189
198
  assert_true File.exist?(target)
190
199
  logs = @i.log.out.logs
191
200
  assert { logs.any? { |l| l.include?("got unrecoverable error in primary and no secondary") } }
@@ -210,6 +219,7 @@ class BufferedOutputBackupTest < Test::Unit::TestCase
210
219
  flush_chunks
211
220
 
212
221
  target = "#{TMP_DIR}/backup/worker0/#{id}/#{@i.dump_unique_id_hex(chunk_id)}.log"
222
+ wait_flush(target)
213
223
  assert_true File.exist?(target)
214
224
  logs = @i.log.out.logs
215
225
  assert { logs.any? { |l| l.include?("got unrecoverable error in primary and secondary type is same as primary") } }
@@ -237,6 +247,7 @@ class BufferedOutputBackupTest < Test::Unit::TestCase
237
247
  flush_chunks
238
248
 
239
249
  target = "#{TMP_DIR}/backup/worker0/#{id}/#{@i.dump_unique_id_hex(chunk_id)}.log"
250
+ wait_flush(target)
240
251
  assert_true File.exist?(target)
241
252
  logs = @i.log.out.logs
242
253
  assert { logs.any? { |l| l.include?("got unrecoverable error in primary. Skip retry and flush chunk to secondary") } }
@@ -262,6 +273,7 @@ class BufferedOutputBackupTest < Test::Unit::TestCase
262
273
  flush_chunks
263
274
 
264
275
  target = "#{TMP_DIR}/backup/worker0/#{id}/#{@i.dump_unique_id_hex(chunk_id)}.log"
276
+ wait_flush(target)
265
277
  assert_true File.exist?(target)
266
278
  logs = @i.log.out.logs
267
279
  assert { logs.any? { |l| l.include?("got unrecoverable error in primary and secondary is async output") } }
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.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-30 00:00:00.000000000 Z
11
+ date: 2018-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -769,7 +769,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
769
769
  version: '0'
770
770
  requirements: []
771
771
  rubyforge_project:
772
- rubygems_version: 2.6.14.1
772
+ rubygems_version: 2.7.6
773
773
  signing_key:
774
774
  specification_version: 4
775
775
  summary: Fluentd event collector