fluentd 1.7.3-x64-mingw32 → 1.7.4-x64-mingw32

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: 558a99919aa105e4c6795da58021418045f44653503f5fea9548bd7d5e34f328
4
- data.tar.gz: 4a096656de96248197fe1563309e87838fef716a5aae6dcc320d0d547b365065
3
+ metadata.gz: 8ac4a6f9d933f5ab055685ea55073ed2075774fcfd06e9d6caa83173fa54bf6a
4
+ data.tar.gz: a6c1591f5668ccfeebbe94f74bed82359cd968011f65c8fae4707f912f09bab7
5
5
  SHA512:
6
- metadata.gz: 60bd1a1629e884935b0f1a7cde880071cd6c131e1ec82ec488877a926f74dc662e610b3af45f9df5e99264173168b464c05f100a30a709882ccaf290818f77d9
7
- data.tar.gz: 3daf26b0e4f81abcbde67f2cf13b73b2856a84c336cea8e0a85a6b947418c418b52f57822b2ca11a351e4e9eeb30cc287241bd32c84dfc6c266692a78fba3b4b
6
+ metadata.gz: 31211269e644bfbfa87535d431c3ee62fe76b67e38c2ed34cc2d76b08849db974b1c940e2dd100f01c18506db63cae8cf6822b7a16191ea019d6f4b408c54ce3
7
+ data.tar.gz: 9b6671277290439f1711de19b1e5634978b285a9392dbeb739e47f6acee296466defac66e4e5b7b60032703821125c0c094f3b9be181209c2cec34dd01afbdf4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # v1.7
2
2
 
3
+ ## Release v1.7.4 - 2019/10/24
4
+
5
+ ### Enhancement
6
+
7
+ * in_http: Add `use_204_response` parameter to return proper 204 response instead of 200.
8
+ fluentd v2 will change this parameter to `true`.
9
+ https://github.com/fluent/fluentd/pull/2640
10
+
11
+ ### Bug fixes
12
+
13
+ * child_process helper: fix stderr blocking for discard case
14
+ https://github.com/fluent/fluentd/pull/2649
15
+ * log: Fix log rotation handling on Windows
16
+ https://github.com/fluent/fluentd/pull/2663
17
+
3
18
  ## Release v1.7.3 - 2019/10/01
4
19
 
5
20
  ### Enhancement
@@ -311,6 +311,16 @@ exit 0 if early_exit
311
311
 
312
312
  require 'fluent/supervisor'
313
313
  if opts[:supervise]
314
+ if Fluent.windows?
315
+ if opts[:log_path] && opts[:log_path] != "-"
316
+ if opts[:log_rotate_age] || opts[:log_rotate_size]
317
+ require 'pathname'
318
+
319
+ log_path = Pathname(opts[:log_path]).sub_ext("-supervisor#{Pathname(opts[:log_path]).extname}").to_s
320
+ opts[:log_path] = log_path
321
+ end
322
+ end
323
+ end
314
324
  Fluent::Supervisor.new(opts).run_supervisor
315
325
  else
316
326
  if opts[:standalone_worker] && opts[:workers] && opts[:workers] > 1
@@ -58,6 +58,8 @@ module Fluent::Plugin
58
58
  config_param :cors_allow_origins, :array, default: nil
59
59
  desc 'Respond with empty gif image of 1x1 pixel.'
60
60
  config_param :respond_with_empty_img, :bool, default: false
61
+ desc 'Respond status code with 204.'
62
+ config_param :use_204_response, :bool, default: false
61
63
 
62
64
  config_section :parse do
63
65
  config_set_default :@type, 'in_http'
@@ -152,7 +154,11 @@ module Fluent::Plugin
152
154
  if @respond_with_empty_img
153
155
  return ["200 OK", {'Content-Type'=>'image/gif; charset=utf-8'}, EMPTY_GIF_IMAGE]
154
156
  else
155
- return ["200 OK", {'Content-Type'=>'text/plain'}, ""]
157
+ if @use_204_response
158
+ return ["204 No Content", {}]
159
+ else
160
+ return ["200 OK", {'Content-Type'=>'text/plain'}, ""]
161
+ end
156
162
  end
157
163
  end
158
164
 
@@ -219,7 +225,11 @@ module Fluent::Plugin
219
225
  if @respond_with_empty_img
220
226
  return ["200 OK", {'Content-Type'=>'image/gif; charset=utf-8'}, EMPTY_GIF_IMAGE]
221
227
  else
222
- return ["200 OK", {'Content-Type'=>'text/plain'}, ""]
228
+ if @use_204_response
229
+ return ["204 No Content", {}]
230
+ else
231
+ return ["200 OK", {'Content-Type'=>'text/plain'}, ""]
232
+ end
223
233
  end
224
234
  end
225
235
 
@@ -257,7 +257,8 @@ module Fluent
257
257
  readio = writeio = stderrio = wait_thread = nil
258
258
  readio_in_use = writeio_in_use = stderrio_in_use = false
259
259
 
260
- if !mode.include?(:stderr) && !mode.include?(:read_with_stderr) && stderr != :discard # connect
260
+ if !mode.include?(:stderr) && !mode.include?(:read_with_stderr)
261
+ spawn_opts[:err] = IO::NULL if stderr == :discard
261
262
  writeio, readio, wait_thread = *Open3.popen2(*spawn_args, spawn_opts)
262
263
  elsif mode.include?(:read_with_stderr)
263
264
  writeio, readio, wait_thread = *Open3.popen2e(*spawn_args, spawn_opts)
@@ -281,7 +282,7 @@ module Fluent
281
282
  stderrio.set_encoding(external_encoding, internal_encoding, encoding_options)
282
283
  stderrio_in_use = true
283
284
  else
284
- stderrio.reopen(IO::NULL) if stderrio && stderrio == :discard
285
+ stderrio.reopen(IO::NULL) if stderrio && stderr == :discard
285
286
  end
286
287
 
287
288
  pid = wait_thread.pid # wait_thread => Process::Waiter
@@ -353,13 +353,21 @@ module Fluent
353
353
  @log_rotate_size = log_rotate_size
354
354
  end
355
355
 
356
+ def worker_id_suffixed_path(worker_id, path)
357
+ require 'pathname'
358
+
359
+ Pathname(path).sub_ext("-#{worker_id}#{Pathname(path).extname}").to_s
360
+ end
361
+
356
362
  def init(process_type, worker_id)
357
363
  @opts[:process_type] = process_type
358
364
  @opts[:worker_id] = worker_id
359
365
 
360
366
  if @path && @path != "-"
361
367
  @logdev = if @log_rotate_age || @log_rotate_size
362
- Fluent::LogDeviceIO.new(@path, shift_age: @log_rotate_age, shift_size: @log_rotate_size)
368
+ Fluent::LogDeviceIO.new(Fluent.windows? ?
369
+ worker_id_suffixed_path(worker_id, @path) : @path,
370
+ shift_age: @log_rotate_age, shift_size: @log_rotate_size)
363
371
  else
364
372
  File.open(@path, "a")
365
373
  end
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Fluent
18
18
 
19
- VERSION = '1.7.3'
19
+ VERSION = '1.7.4'
20
20
 
21
21
  end
@@ -32,6 +32,7 @@ class HttpInputTest < Test::Unit::TestCase
32
32
  body_size_limit 10m
33
33
  keepalive_timeout 5
34
34
  respond_with_empty_img true
35
+ use_204_response false
35
36
  ]
36
37
 
37
38
  def create_driver(conf=CONFIG)
@@ -549,8 +550,8 @@ class HttpInputTest < Test::Unit::TestCase
549
550
  assert_equal_event_time time, d.events[1][1]
550
551
  end
551
552
 
552
- def test_resonse_with_empty_img
553
- d = create_driver(CONFIG + "respond_with_empty_img true")
553
+ def test_response_with_empty_img
554
+ d = create_driver(CONFIG)
554
555
  assert_equal true, d.instance.respond_with_empty_img
555
556
 
556
557
  time = event_time("2011-01-02 13:14:15 UTC")
@@ -577,6 +578,61 @@ class HttpInputTest < Test::Unit::TestCase
577
578
  assert_equal_event_time time, d.events[1][1]
578
579
  end
579
580
 
581
+ def test_response_without_empty_img
582
+ d = create_driver(CONFIG + "respond_with_empty_img false")
583
+ assert_equal false, d.instance.respond_with_empty_img
584
+
585
+ time = event_time("2011-01-02 13:14:15 UTC")
586
+ time_i = time.to_i
587
+ events = [
588
+ ["tag1", time, {"a"=>1}],
589
+ ["tag2", time, {"a"=>2}],
590
+ ]
591
+ res_codes = []
592
+ res_bodies = []
593
+
594
+ d.run do
595
+ events.each do |tag, _t, record|
596
+ res = post("/#{tag}", {"json"=>record.to_json, "time"=>time_i.to_s})
597
+ res_codes << res.code
598
+ end
599
+ end
600
+ assert_equal ["200", "200"], res_codes
601
+ assert_equal [], res_bodies
602
+ assert_equal events, d.events
603
+ assert_equal_event_time time, d.events[0][1]
604
+ assert_equal_event_time time, d.events[1][1]
605
+ end
606
+
607
+ def test_response_use_204_response
608
+ d = create_driver(CONFIG + %[
609
+ respond_with_empty_img false
610
+ use_204_response true
611
+ ])
612
+ assert_equal true, d.instance.use_204_response
613
+
614
+ time = event_time("2011-01-02 13:14:15 UTC")
615
+ time_i = time.to_i
616
+ events = [
617
+ ["tag1", time, {"a"=>1}],
618
+ ["tag2", time, {"a"=>2}],
619
+ ]
620
+ res_codes = []
621
+ res_bodies = []
622
+
623
+ d.run do
624
+ events.each do |tag, _t, record|
625
+ res = post("/#{tag}", {"json"=>record.to_json, "time"=>time_i.to_s})
626
+ res_codes << res.code
627
+ end
628
+ end
629
+ assert_equal ["204", "204"], res_codes
630
+ assert_equal [], res_bodies
631
+ assert_equal events, d.events
632
+ assert_equal_event_time time, d.events[0][1]
633
+ assert_equal_event_time time, d.events[1][1]
634
+ end
635
+
580
636
  def test_cors_allowed
581
637
  d = create_driver(CONFIG + "cors_allow_origins [\"http://foo.com\"]")
582
638
  assert_equal ["http://foo.com"], d.instance.cors_allow_origins
@@ -124,6 +124,43 @@ class ChildProcessTest < Test::Unit::TestCase
124
124
  assert_equal expected, ary
125
125
  end
126
126
 
127
+ test 'can execute external command at just once, which can handle both of read and write. Ignore stderr message/no block' do
128
+ m = Mutex.new
129
+ ary = []
130
+ Timeout.timeout(TEST_DEADLOCK_TIMEOUT) do
131
+ ran = false
132
+ # lots of stderr message should not be blocked and message should not be printed in test.
133
+ cmd = "ruby -e 'while !STDIN.eof? && line = STDIN.readline; STDERR.puts line.chomp * 1000; STDOUT.puts line.chomp; STDOUT.flush rescue nil; end'"
134
+ @d.child_process_execute(:t2_and_ignore_stderr, cmd, mode: [:write, :read]) do |writeio, readio|
135
+ m.lock
136
+ ran = true
137
+
138
+ [[1,2],[3,4],[5,6]].each do |i,j|
139
+ writeio.write "my data#{i}\n"
140
+ writeio.write "my data#{j}\n"
141
+ writeio.flush
142
+ end
143
+ writeio.close
144
+
145
+ while line = readio.readline
146
+ ary << line
147
+ end
148
+ m.unlock
149
+ end
150
+ begin
151
+ sleep TEST_WAIT_INTERVAL_FOR_BLOCK_RUNNING until m.locked? || ran
152
+ m.lock
153
+ rescue
154
+ ensure
155
+ m.unlock
156
+ end
157
+ end
158
+
159
+ assert_equal [], @d.log.out.logs
160
+ expected = (1..6).map{|i| "my data#{i}\n" }
161
+ assert_equal expected, ary
162
+ end
163
+
127
164
  test 'can execute external command at just once, which can handle all of read, write and stderr' do
128
165
  m = Mutex.new
129
166
  ary1 = []
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.7.3
4
+ version: 1.7.4
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-01 00:00:00.000000000 Z
11
+ date: 2019-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack