fluentd 1.16.9 → 1.16.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +6 -6
- data/CHANGELOG.md +37 -0
- data/README.md +0 -1
- data/SECURITY.md +6 -4
- data/fluentd.gemspec +5 -0
- data/lib/fluent/plugin/out_forward.rb +10 -0
- data/lib/fluent/plugin_helper/server.rb +4 -1
- data/lib/fluent/test.rb +5 -2
- data/lib/fluent/version.rb +1 -1
- data/test/command/test_fluentd.rb +1 -1
- data/test/config/test_dsl.rb +8 -1
- data/test/config/test_element.rb +2 -2
- data/test/plugin/test_filter_stdout.rb +4 -4
- data/test/plugin/test_formatter_hash.rb +2 -2
- data/test/plugin/test_in_object_space.rb +4 -0
- data/test/plugin/test_out_forward.rb +59 -34
- data/test/plugin/test_out_stdout.rb +3 -3
- data/test/plugin_helper/test_child_process.rb +4 -4
- data/test/plugin_helper/test_server.rb +19 -0
- data/test/test_configdsl.rb +8 -1
- data/test/test_plugin_helper.rb +1 -1
- data/test/test_supervisor.rb +4 -2
- metadata +44 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 255e643927676bb2d1414a29cb709d70b72e562a09d83a1a2532c6be1e0dfa89
|
|
4
|
+
data.tar.gz: 34703e891bc6cf823c88b98fa920fe049d54da981c466be21e63a684966d6988
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3be646bf7c7ce861dcd8e842527d80d49eba0c3fc899f7f972db30e443bd8a749073167f1d8bcb70d24c8ab6a636388c2b0ea19423f58ed0f57687198b7b8dfb
|
|
7
|
+
data.tar.gz: a7740e6e6b8ec714811ce128725964a4108b456e0f12d5ef8a98ea95a151fba151fda0ac54ca49ed42c213b66d45b20f9879948f7b04ea3f00d2808816221646
|
data/.github/workflows/test.yml
CHANGED
|
@@ -26,10 +26,10 @@ jobs:
|
|
|
26
26
|
fail-fast: false
|
|
27
27
|
matrix:
|
|
28
28
|
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
|
|
29
|
-
ruby-version: ['3.3', '3.2', '3.1', '3.0', '2.7']
|
|
29
|
+
ruby-version: ['3.4', '3.3', '3.2', '3.1', '3.0', '2.7']
|
|
30
30
|
name: Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}
|
|
31
31
|
steps:
|
|
32
|
-
- uses: actions/checkout@
|
|
32
|
+
- uses: actions/checkout@v5
|
|
33
33
|
- name: Set up Ruby
|
|
34
34
|
uses: ruby/setup-ruby@v1
|
|
35
35
|
with:
|
|
@@ -41,19 +41,19 @@ jobs:
|
|
|
41
41
|
- name: Install dependencies
|
|
42
42
|
run: bundle install
|
|
43
43
|
- name: Run tests
|
|
44
|
-
run: bundle exec rake test TESTOPTS="-v --no-show-detail-immediately"
|
|
44
|
+
run: bundle exec rake test TESTOPTS="-v --report-slow-tests --no-show-detail-immediately"
|
|
45
45
|
|
|
46
46
|
test-windows-service:
|
|
47
47
|
runs-on: windows-latest
|
|
48
48
|
strategy:
|
|
49
49
|
fail-fast: false
|
|
50
50
|
matrix:
|
|
51
|
-
ruby-version: ['3.3', '3.2', '3.1', '3.0', '2.7']
|
|
51
|
+
ruby-version: ['3.4', '3.3', '3.2', '3.1', '3.0', '2.7']
|
|
52
52
|
name: Windows service (Ruby ${{ matrix.ruby-version }})
|
|
53
53
|
steps:
|
|
54
|
-
- uses: actions/checkout@
|
|
54
|
+
- uses: actions/checkout@v5
|
|
55
55
|
- name: Set up Ruby
|
|
56
|
-
uses: ruby/setup-ruby@
|
|
56
|
+
uses: ruby/setup-ruby@v1
|
|
57
57
|
with:
|
|
58
58
|
ruby-version: ${{ matrix.ruby-version }}
|
|
59
59
|
- name: Install dependencies
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# v1.16
|
|
2
2
|
|
|
3
|
+
## Release v1.16.11 - 2025/12/12
|
|
4
|
+
|
|
5
|
+
### Bug Fix
|
|
6
|
+
|
|
7
|
+
* out_forward: fix issue where could cause output to stop when using `<security>` and TLS setting together under unstable network environments
|
|
8
|
+
https://github.com/fluent/fluentd/pull/5137
|
|
9
|
+
|
|
10
|
+
### Misc
|
|
11
|
+
|
|
12
|
+
* Add missing gem dependency on Ruby 3.4.
|
|
13
|
+
https://github.com/fluent/fluentd/pull/5172
|
|
14
|
+
|
|
15
|
+
* CI improvemnts
|
|
16
|
+
https://github.com/fluent/fluentd/pull/5135
|
|
17
|
+
https://github.com/fluent/fluentd/pull/5175
|
|
18
|
+
https://github.com/fluent/fluentd/pull/5182
|
|
19
|
+
https://github.com/fluent/fluentd/pull/5183
|
|
20
|
+
https://github.com/fluent/fluentd/pull/5185
|
|
21
|
+
https://github.com/fluent/fluentd/pull/5187
|
|
22
|
+
https://github.com/fluent/fluentd/pull/5189
|
|
23
|
+
|
|
24
|
+
## Release v1.16.10 - 2025/09/12
|
|
25
|
+
|
|
26
|
+
### Bug Fix
|
|
27
|
+
|
|
28
|
+
* server plugin helper: ensure to close all connections at shutdown
|
|
29
|
+
https://github.com/fluent/fluentd/pull/5088
|
|
30
|
+
|
|
31
|
+
### Misc
|
|
32
|
+
|
|
33
|
+
* CI improvemnts
|
|
34
|
+
https://github.com/fluent/fluentd/pull/5083
|
|
35
|
+
https://github.com/fluent/fluentd/pull/5085
|
|
36
|
+
https://github.com/fluent/fluentd/pull/5086
|
|
37
|
+
https://github.com/fluent/fluentd/pull/5091
|
|
38
|
+
https://github.com/fluent/fluentd/pull/5092
|
|
39
|
+
|
|
3
40
|
## Release v1.16.9 - 2025/05/14
|
|
4
41
|
|
|
5
42
|
### Bug Fix
|
data/README.md
CHANGED
|
@@ -4,7 +4,6 @@ Fluentd: Open-Source Log Collector
|
|
|
4
4
|
[](https://github.com/fluent/fluentd/actions/workflows/linux-test.yaml)
|
|
5
5
|
[](https://github.com/fluent/fluentd/actions/workflows/windows-test.yaml)
|
|
6
6
|
[](https://github.com/fluent/fluentd/actions/workflows/macos-test.yaml)
|
|
7
|
-
[](https://codeclimate.com/github/fluent/fluentd)
|
|
8
7
|
[](https://bestpractices.coreinfrastructure.org/projects/1189)
|
|
9
8
|
|
|
10
9
|
[Fluentd](https://www.fluentd.org/) collects events from various data sources and writes them to files, RDBMS, NoSQL, IaaS, SaaS, Hadoop and so on. Fluentd helps you unify your logging infrastructure (Learn more about the [Unified Logging Layer](https://www.fluentd.org/blog/unified-logging-layer)).
|
data/SECURITY.md
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## Supported Versions
|
|
4
4
|
|
|
5
|
-
|
|
|
6
|
-
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
|-----------|--------------------|
|
|
7
|
+
| 1.19.x | :white_check_mark: |
|
|
8
|
+
| 1.18.x | :x: |
|
|
9
|
+
| 1.17.x | :x: |
|
|
7
10
|
| 1.16.x | :white_check_mark: |
|
|
8
|
-
| 1.15.x
|
|
9
|
-
| <= 1.14.x | :x: |
|
|
11
|
+
| <= 1.15.x | :x: |
|
|
10
12
|
|
|
11
13
|
## Reporting a Vulnerability
|
|
12
14
|
|
data/fluentd.gemspec
CHANGED
|
@@ -31,6 +31,11 @@ Gem::Specification.new do |gem|
|
|
|
31
31
|
gem.add_runtime_dependency("webrick", ["~> 1.4"])
|
|
32
32
|
gem.add_runtime_dependency("console", ["< 1.24"])
|
|
33
33
|
|
|
34
|
+
# gems that aren't default gems as of Ruby 3.4
|
|
35
|
+
gem.add_runtime_dependency("base64", ["~> 0.2"])
|
|
36
|
+
gem.add_runtime_dependency("csv", ["~> 3.2"])
|
|
37
|
+
gem.add_runtime_dependency("drb", ["~> 2.2"])
|
|
38
|
+
|
|
34
39
|
# gems that aren't default gems as of Ruby 3.5
|
|
35
40
|
gem.add_runtime_dependency("logger", ["~> 1.6"])
|
|
36
41
|
|
|
@@ -610,7 +610,17 @@ module Fluent::Plugin
|
|
|
610
610
|
end
|
|
611
611
|
|
|
612
612
|
def establish_connection(sock, ri)
|
|
613
|
+
start_time = Fluent::Clock.now
|
|
614
|
+
timeout = @sender.hard_timeout
|
|
615
|
+
|
|
613
616
|
while ri.state != :established
|
|
617
|
+
# Check for timeout to prevent infinite loop
|
|
618
|
+
if Fluent::Clock.now - start_time > timeout
|
|
619
|
+
@log.warn "handshake timeout after #{timeout}s", host: @host, port: @port
|
|
620
|
+
disable!
|
|
621
|
+
break
|
|
622
|
+
end
|
|
623
|
+
|
|
614
624
|
begin
|
|
615
625
|
# TODO: On Ruby 2.2 or earlier, read_nonblock doesn't work expectedly.
|
|
616
626
|
# We need rewrite around here using new socket/server plugin helper.
|
|
@@ -347,7 +347,10 @@ module Fluent
|
|
|
347
347
|
end
|
|
348
348
|
|
|
349
349
|
def shutdown
|
|
350
|
-
@_server_connections
|
|
350
|
+
# When it invokes conn.cose, it reduces elements in @_server_connections by close_callback,
|
|
351
|
+
# and it reduces the number of loops. This prevents the connection closing.
|
|
352
|
+
# So, it requires invoking #dup to avoid the problem.
|
|
353
|
+
@_server_connections.dup.each do |conn|
|
|
351
354
|
conn.close rescue nil
|
|
352
355
|
end
|
|
353
356
|
|
data/lib/fluent/test.rb
CHANGED
|
@@ -40,9 +40,12 @@ module Fluent
|
|
|
40
40
|
|
|
41
41
|
$log = dummy_logger
|
|
42
42
|
|
|
43
|
-
Fluent.__send__(:remove_const, :Engine)
|
|
44
|
-
|
|
43
|
+
old_engine = Fluent.__send__(:remove_const, :Engine)
|
|
44
|
+
# Ensure that GC can remove the objects of the old engine.
|
|
45
|
+
# Some objects can still exist after `remove_const`. See https://github.com/fluent/fluentd/issues/5054.
|
|
46
|
+
old_engine.instance_variable_set(:@root_agent, nil)
|
|
45
47
|
|
|
48
|
+
engine = Fluent.const_set(:Engine, EngineClass.new).init(SystemConfig.new)
|
|
46
49
|
engine.define_singleton_method(:now=) {|n|
|
|
47
50
|
@now = n
|
|
48
51
|
}
|
data/lib/fluent/version.rb
CHANGED
data/test/config/test_dsl.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require_relative '../helper'
|
|
2
2
|
require 'fluent/config/element'
|
|
3
3
|
require "fluent/config/dsl"
|
|
4
|
+
require 'tempfile'
|
|
4
5
|
|
|
5
6
|
TMP_DIR = File.dirname(__FILE__) + "/tmp/config_dsl#{ENV['TEST_ENV_NUMBER']}"
|
|
6
7
|
def write_config(path, data)
|
|
@@ -358,9 +359,13 @@ module Fluent::Config
|
|
|
358
359
|
sub_test_case '.parse' do
|
|
359
360
|
test 'can get result of Kernel.open() by ruby.open()' do
|
|
360
361
|
uname_string = `uname -a`
|
|
362
|
+
tmpfile = Tempfile.create('fluentd-test')
|
|
363
|
+
tmpfile.write(uname_string)
|
|
364
|
+
tmpfile.close
|
|
365
|
+
|
|
361
366
|
root = Fluent::Config::DSL::Parser.parse(<<DSL)
|
|
362
367
|
worker {
|
|
363
|
-
uname_str = ruby.open(
|
|
368
|
+
uname_str = ruby.open("#{tmpfile.path}"){|out| out.read}
|
|
364
369
|
source {
|
|
365
370
|
uname uname_str
|
|
366
371
|
}
|
|
@@ -372,6 +377,8 @@ DSL
|
|
|
372
377
|
assert_equal('source', source.name)
|
|
373
378
|
assert_equal(1, source.keys.size)
|
|
374
379
|
assert_equal(uname_string, source['uname'])
|
|
380
|
+
ensure
|
|
381
|
+
File.delete(tmpfile.path)
|
|
375
382
|
end
|
|
376
383
|
|
|
377
384
|
test 'accepts ruby keyword with block, which allow to use methods included from ::Kernel' do
|
data/test/config/test_element.rb
CHANGED
|
@@ -282,8 +282,8 @@ CONF
|
|
|
282
282
|
dump = <<-CONF
|
|
283
283
|
name:ROOT, arg:, {\"k1\"=>\"v1\"}, [name:test, arg:ext, {\"k2\"=>\"v2\"}, []]
|
|
284
284
|
CONF
|
|
285
|
-
assert_not_equal(e.to_s, e.inspect)
|
|
286
|
-
assert_equal(dump.chomp, e.inspect)
|
|
285
|
+
assert_not_equal(e.to_s, e.inspect.gsub(' => ', '=>'))
|
|
286
|
+
assert_equal(dump.chomp, e.inspect.gsub(' => ', '=>'))
|
|
287
287
|
end
|
|
288
288
|
end
|
|
289
289
|
|
|
@@ -86,12 +86,12 @@ class StdoutFilterTest < Test::Unit::TestCase
|
|
|
86
86
|
d = create_driver(CONFIG + config_element("", "", { "output_type" => "hash" }))
|
|
87
87
|
etime = event_time("2016-10-07 21:09:31.012345678 UTC")
|
|
88
88
|
out = capture_log(d) { filter(d, etime, {'test' => 'test'}) }
|
|
89
|
-
assert_equal "2016-10-07 21:09:31.012345678 +0000 filter.test: {\"test\"=>\"test\"}\n", out
|
|
89
|
+
assert_equal "2016-10-07 21:09:31.012345678 +0000 filter.test: {\"test\"=>\"test\"}\n", out.gsub(' => ', '=>')
|
|
90
90
|
|
|
91
91
|
# NOTE: Float::NAN is not jsonable, but hash string can output it.
|
|
92
92
|
d = create_driver(CONFIG + config_element("", "", { "output_type" => "hash" }))
|
|
93
93
|
out = capture_log(d) { filter(d, etime, {'test' => Float::NAN}) }
|
|
94
|
-
assert_equal "2016-10-07 21:09:31.012345678 +0000 filter.test: {\"test\"=>NaN}\n", out
|
|
94
|
+
assert_equal "2016-10-07 21:09:31.012345678 +0000 filter.test: {\"test\"=>NaN}\n", out.gsub(' => ', '=>')
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
# Use include_time_key to output the message's time
|
|
@@ -172,7 +172,7 @@ class StdoutFilterTest < Test::Unit::TestCase
|
|
|
172
172
|
d = create_driver(conf)
|
|
173
173
|
etime = event_time("2016-10-07 21:09:31.012345678 UTC")
|
|
174
174
|
out = capture_log(d) { filter(d, etime, {'test' => 'test'}) }
|
|
175
|
-
assert_equal "2016-10-07 21:09:31.012345678 +0000 filter.test: {\"test\"=>\"test\"}\n", out
|
|
175
|
+
assert_equal "2016-10-07 21:09:31.012345678 +0000 filter.test: {\"test\"=>\"test\"}\n", out.gsub(' => ', '=>')
|
|
176
176
|
end
|
|
177
177
|
|
|
178
178
|
def test_hash_nan
|
|
@@ -182,7 +182,7 @@ class StdoutFilterTest < Test::Unit::TestCase
|
|
|
182
182
|
d = create_driver(conf)
|
|
183
183
|
etime = event_time("2016-10-07 21:09:31.012345678 UTC")
|
|
184
184
|
out = capture_log(d) { filter(d, etime, {'test' => Float::NAN}) }
|
|
185
|
-
assert_equal "2016-10-07 21:09:31.012345678 +0000 filter.test: {\"test\"=>NaN}\n", out
|
|
185
|
+
assert_equal "2016-10-07 21:09:31.012345678 +0000 filter.test: {\"test\"=>NaN}\n", out.gsub(' => ', '=>')
|
|
186
186
|
end
|
|
187
187
|
|
|
188
188
|
# Use include_time_key to output the message's time
|
|
@@ -26,13 +26,13 @@ class HashFormatterTest < ::Test::Unit::TestCase
|
|
|
26
26
|
d = create_driver({"newline" => newline_conf})
|
|
27
27
|
formatted = d.instance.format(tag, @time, record)
|
|
28
28
|
|
|
29
|
-
assert_equal(%Q!{"message"=>"awesome", "greeting"=>"hello"}#{newline}!, formatted.encode(Encoding::UTF_8))
|
|
29
|
+
assert_equal(%Q!{"message"=>"awesome", "greeting"=>"hello"}#{newline}!, formatted.gsub(' => ', '=>').encode(Encoding::UTF_8))
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def test_format_without_newline
|
|
33
33
|
d = create_driver('add_newline' => false)
|
|
34
34
|
formatted = d.instance.format(tag, @time, record)
|
|
35
35
|
|
|
36
|
-
assert_equal(%Q!{"message"=>"awesome", "greeting"=>"hello"}!, formatted.encode(Encoding::UTF_8))
|
|
36
|
+
assert_equal(%Q!{"message"=>"awesome", "greeting"=>"hello"}!, formatted.gsub(' => ', '=>').encode(Encoding::UTF_8))
|
|
37
37
|
end
|
|
38
38
|
end
|
|
@@ -50,6 +50,10 @@ class ObjectSpaceInputTest < Test::Unit::TestCase
|
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def test_emit
|
|
53
|
+
# Force release garbaged objects due to avoid unexpected error by mock objects on `on_timer`
|
|
54
|
+
# https://github.com/fluent/fluentd/pull/5055
|
|
55
|
+
GC.start
|
|
56
|
+
|
|
53
57
|
d = create_driver
|
|
54
58
|
|
|
55
59
|
d.run(expect_emits: 3)
|
|
@@ -178,6 +178,42 @@ EOL
|
|
|
178
178
|
assert{ logs.any?{|log| log.include?(expected_log) && log.include?(expected_detail) } }
|
|
179
179
|
end
|
|
180
180
|
|
|
181
|
+
sub_test_case 'configure compress' do
|
|
182
|
+
data('default', ['', :text])
|
|
183
|
+
data('gzip', ['compress gzip', :gzip])
|
|
184
|
+
test 'should be applied' do |(option, expected)|
|
|
185
|
+
@d = d = create_driver(config + option)
|
|
186
|
+
node = d.instance.nodes.first
|
|
187
|
+
|
|
188
|
+
assert_equal(
|
|
189
|
+
[expected, expected],
|
|
190
|
+
[d.instance.compress, node.instance_variable_get(:@compress)]
|
|
191
|
+
)
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# TODO add tests that we cannot configure the different compress type between owner and buffer except for :text
|
|
195
|
+
data('gzip', ['compress gzip', :text, :gzip])
|
|
196
|
+
test 'can configure buffer compress separately when owner uses :text' do |(buffer_option, expected_owner_compress, expected_buffer_compress)|
|
|
197
|
+
@d = d = create_driver(config + %[
|
|
198
|
+
<buffer>
|
|
199
|
+
type memory
|
|
200
|
+
#{buffer_option}
|
|
201
|
+
</buffer>
|
|
202
|
+
])
|
|
203
|
+
node = d.instance.nodes.first
|
|
204
|
+
|
|
205
|
+
assert_equal(
|
|
206
|
+
[expected_owner_compress, expected_owner_compress, expected_buffer_compress],
|
|
207
|
+
[d.instance.compress, node.instance_variable_get(:@compress), d.instance.buffer.compress],
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
log_message = "buffer is compressed. If you also want to save the bandwidth of a network, Add `compress` configuration in <match>"
|
|
211
|
+
assert do
|
|
212
|
+
d.logs.any? { |log| log.include?(log_message) }
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
|
|
181
217
|
data('CA cert' => 'tls_ca_cert_path',
|
|
182
218
|
'non CA cert' => 'tls_cert_path')
|
|
183
219
|
test 'configure tls_cert_path/tls_ca_cert_path' do |param|
|
|
@@ -326,40 +362,6 @@ EOL
|
|
|
326
362
|
assert_equal 1234, d.instance.discovery_manager.services[0].port
|
|
327
363
|
end
|
|
328
364
|
|
|
329
|
-
test 'compress_default_value' do
|
|
330
|
-
@d = d = create_driver
|
|
331
|
-
assert_equal :text, d.instance.compress
|
|
332
|
-
|
|
333
|
-
node = d.instance.nodes.first
|
|
334
|
-
assert_equal :text, node.instance_variable_get(:@compress)
|
|
335
|
-
end
|
|
336
|
-
|
|
337
|
-
test 'set_compress_is_gzip' do
|
|
338
|
-
@d = d = create_driver(config + %[compress gzip])
|
|
339
|
-
assert_equal :gzip, d.instance.compress
|
|
340
|
-
assert_equal :gzip, d.instance.buffer.compress
|
|
341
|
-
|
|
342
|
-
node = d.instance.nodes.first
|
|
343
|
-
assert_equal :gzip, node.instance_variable_get(:@compress)
|
|
344
|
-
end
|
|
345
|
-
|
|
346
|
-
test 'set_compress_is_gzip_in_buffer_section' do
|
|
347
|
-
mock = flexmock($log)
|
|
348
|
-
mock.should_receive(:log).with("buffer is compressed. If you also want to save the bandwidth of a network, Add `compress` configuration in <match>")
|
|
349
|
-
|
|
350
|
-
@d = d = create_driver(config + %[
|
|
351
|
-
<buffer>
|
|
352
|
-
type memory
|
|
353
|
-
compress gzip
|
|
354
|
-
</buffer>
|
|
355
|
-
])
|
|
356
|
-
assert_equal :text, d.instance.compress
|
|
357
|
-
assert_equal :gzip, d.instance.buffer.compress
|
|
358
|
-
|
|
359
|
-
node = d.instance.nodes.first
|
|
360
|
-
assert_equal :text, node.instance_variable_get(:@compress)
|
|
361
|
-
end
|
|
362
|
-
|
|
363
365
|
test 'phi_failure_detector disabled' do
|
|
364
366
|
@d = d = create_driver(config + %[phi_failure_detector false \n phi_threshold 0])
|
|
365
367
|
node = d.instance.nodes.first
|
|
@@ -1345,4 +1347,27 @@ EOL
|
|
|
1345
1347
|
end
|
|
1346
1348
|
end
|
|
1347
1349
|
end
|
|
1350
|
+
|
|
1351
|
+
test 'establish_connection_timeout' do
|
|
1352
|
+
@d = d = create_driver(%[
|
|
1353
|
+
hard_timeout 1
|
|
1354
|
+
<server>
|
|
1355
|
+
host #{TARGET_HOST}
|
|
1356
|
+
port #{@target_port}
|
|
1357
|
+
</server>
|
|
1358
|
+
])
|
|
1359
|
+
|
|
1360
|
+
node = d.instance.nodes.first
|
|
1361
|
+
mock_sock = flexmock('socket')
|
|
1362
|
+
mock_sock.should_receive(:read_nonblock).with(512).and_return('').at_least.once
|
|
1363
|
+
|
|
1364
|
+
ri = Fluent::Plugin::ForwardOutput::ConnectionManager::RequestInfo.new(:helo)
|
|
1365
|
+
|
|
1366
|
+
assert_true node.available?
|
|
1367
|
+
node.establish_connection(mock_sock, ri)
|
|
1368
|
+
assert_false node.available?
|
|
1369
|
+
|
|
1370
|
+
logs = d.logs
|
|
1371
|
+
assert{ logs.any?{|log| log.include?('handshake timeout after 1.0s') } }
|
|
1372
|
+
end
|
|
1348
1373
|
end
|
|
@@ -95,11 +95,11 @@ class StdoutOutputTest < Test::Unit::TestCase
|
|
|
95
95
|
d.feed(time, {'test' => 'test2'})
|
|
96
96
|
end
|
|
97
97
|
end
|
|
98
|
-
assert_equal "#{Time.at(time).localtime.strftime(TIME_FORMAT)} test: {\"test\"=>\"test2\"}\n", out
|
|
98
|
+
assert_equal "#{Time.at(time).localtime.strftime(TIME_FORMAT)} test: {\"test\"=>\"test2\"}\n", out.gsub(' => ', '=>')
|
|
99
99
|
|
|
100
100
|
# NOTE: Float::NAN is not jsonable, but hash string can output it.
|
|
101
101
|
out = capture_log { d.feed('test', time, {'test' => Float::NAN}) }
|
|
102
|
-
assert_equal "#{Time.at(time).localtime.strftime(TIME_FORMAT)} test: {\"test\"=>NaN}\n", out
|
|
102
|
+
assert_equal "#{Time.at(time).localtime.strftime(TIME_FORMAT)} test: {\"test\"=>NaN}\n", out.gsub(' => ', '=>')
|
|
103
103
|
end
|
|
104
104
|
end
|
|
105
105
|
|
|
@@ -171,7 +171,7 @@ class StdoutOutputTest < Test::Unit::TestCase
|
|
|
171
171
|
end
|
|
172
172
|
end
|
|
173
173
|
|
|
174
|
-
assert_equal "#{Time.at(time).localtime.strftime(TIME_FORMAT)} test: {\"test\"=>\"test\"}\n", out
|
|
174
|
+
assert_equal "#{Time.at(time).localtime.strftime(TIME_FORMAT)} test: {\"test\"=>\"test\"}\n", out.gsub(' => ', '=>')
|
|
175
175
|
end
|
|
176
176
|
end
|
|
177
177
|
end
|
|
@@ -569,7 +569,7 @@ class ChildProcessTest < Test::Unit::TestCase
|
|
|
569
569
|
unless Fluent.windows?
|
|
570
570
|
test 'can specify subprocess name' do
|
|
571
571
|
io = IO.popen([["cat", "caaaaaaaaaaat"], '-'])
|
|
572
|
-
process_naming_enabled = (
|
|
572
|
+
process_naming_enabled = (IO.popen(["ps", "opid,cmd"]){|_io| _io.readlines }.count{|line| line.include?("caaaaaaaaaaat") } > 0)
|
|
573
573
|
Process.kill(:TERM, io.pid) rescue nil
|
|
574
574
|
io.close rescue nil
|
|
575
575
|
|
|
@@ -586,7 +586,7 @@ class ChildProcessTest < Test::Unit::TestCase
|
|
|
586
586
|
m.lock
|
|
587
587
|
ran = true
|
|
588
588
|
pids << @d.child_process_id
|
|
589
|
-
proc_lines +=
|
|
589
|
+
proc_lines += IO.popen(["ps", "opid,cmd"]){|_io| _io.readlines }
|
|
590
590
|
m.unlock
|
|
591
591
|
readio.read
|
|
592
592
|
end
|
|
@@ -645,8 +645,8 @@ class ChildProcessTest < Test::Unit::TestCase
|
|
|
645
645
|
unless Fluent.windows?
|
|
646
646
|
test 'can change working directory' do
|
|
647
647
|
# check my real /tmp directory (for mac)
|
|
648
|
-
cmd =
|
|
649
|
-
mytmpdir =
|
|
648
|
+
cmd = ['ruby', '-e', 'Dir.chdir("/tmp"); puts Dir.pwd']
|
|
649
|
+
mytmpdir = IO.popen(cmd){|io| io.read.chomp }
|
|
650
650
|
|
|
651
651
|
m = Mutex.new
|
|
652
652
|
str = nil
|
|
@@ -364,6 +364,25 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
|
364
364
|
d2.stop; d2.before_shutdown; d2.shutdown; d2.after_shutdown; d2.close; d2.terminate
|
|
365
365
|
end
|
|
366
366
|
end
|
|
367
|
+
|
|
368
|
+
test 'close all connections by shutdown' do
|
|
369
|
+
@d.server_create_tcp(:s, @port) do |data, conn|
|
|
370
|
+
end
|
|
371
|
+
|
|
372
|
+
client_sockets = []
|
|
373
|
+
5.times do
|
|
374
|
+
client_sockets << TCPSocket.open("127.0.0.1", @port)
|
|
375
|
+
end
|
|
376
|
+
waiting(4){ sleep 0.1 until @d.instance_variable_get(:@_server_connections).size == 5 }
|
|
377
|
+
|
|
378
|
+
@d.stop
|
|
379
|
+
@d.before_shutdown
|
|
380
|
+
@d.shutdown
|
|
381
|
+
|
|
382
|
+
assert_true @d.instance_variable_get(:@_server_connections).empty?
|
|
383
|
+
ensure
|
|
384
|
+
client_sockets.each(&:close)
|
|
385
|
+
end
|
|
367
386
|
end
|
|
368
387
|
|
|
369
388
|
sub_test_case '#server_create' do
|
data/test/test_configdsl.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require_relative 'helper'
|
|
2
2
|
require 'fluent/config/dsl'
|
|
3
3
|
require 'fluent/test'
|
|
4
|
+
require 'tempfile'
|
|
4
5
|
|
|
5
6
|
class ConfigDSLTest < Test::Unit::TestCase
|
|
6
7
|
# TEST_CONFIG1 = %[
|
|
@@ -107,8 +108,12 @@ match('aa')
|
|
|
107
108
|
|
|
108
109
|
def test_with_ruby_keyword
|
|
109
110
|
uname_string = `uname -a`
|
|
111
|
+
tmpfile = Tempfile.create('fluentd-test')
|
|
112
|
+
tmpfile.write(uname_string)
|
|
113
|
+
tmpfile.close
|
|
114
|
+
|
|
110
115
|
root1 = Fluent::Config::DSL::Parser.parse(<<DSL)
|
|
111
|
-
uname_str = ruby.open(
|
|
116
|
+
uname_str = ruby.open("#{tmpfile.path}"){|out| out.read}
|
|
112
117
|
source {
|
|
113
118
|
uname uname_str
|
|
114
119
|
}
|
|
@@ -144,5 +149,7 @@ source {
|
|
|
144
149
|
}
|
|
145
150
|
DSL
|
|
146
151
|
assert_raise (NoMethodError) { Fluent::Config::DSL::Parser.parse(conf3) }
|
|
152
|
+
ensure
|
|
153
|
+
File.delete(tmpfile.path)
|
|
147
154
|
end
|
|
148
155
|
end
|
data/test/test_plugin_helper.rb
CHANGED
|
@@ -2,7 +2,7 @@ require_relative 'helper'
|
|
|
2
2
|
require 'fluent/plugin_helper'
|
|
3
3
|
require 'fluent/plugin/base'
|
|
4
4
|
|
|
5
|
-
class
|
|
5
|
+
class PluginHelperTest < Test::Unit::TestCase
|
|
6
6
|
module FluentTest; end
|
|
7
7
|
|
|
8
8
|
sub_test_case 'Fluent::Plugin::Base.helpers method works as shortcut to include helper modules' do
|
data/test/test_supervisor.rb
CHANGED
|
@@ -353,6 +353,7 @@ class SupervisorTest < ::Test::Unit::TestCase
|
|
|
353
353
|
event = Win32::Event.open("TestFluentdEvent")
|
|
354
354
|
event.set
|
|
355
355
|
event.close
|
|
356
|
+
sleep 1.0 # Wait for dumping
|
|
356
357
|
ensure
|
|
357
358
|
server.stop_windows_event_thread
|
|
358
359
|
end
|
|
@@ -379,6 +380,7 @@ class SupervisorTest < ::Test::Unit::TestCase
|
|
|
379
380
|
event = Win32::Event.open("TestFluentdEvent_USR1")
|
|
380
381
|
event.set
|
|
381
382
|
event.close
|
|
383
|
+
sleep 1.0 # Wait for dumping
|
|
382
384
|
ensure
|
|
383
385
|
server.stop_windows_event_thread
|
|
384
386
|
end
|
|
@@ -405,7 +407,7 @@ class SupervisorTest < ::Test::Unit::TestCase
|
|
|
405
407
|
# https://github.com/fluent/fluentd/issues/4063
|
|
406
408
|
GC.start
|
|
407
409
|
|
|
408
|
-
ENV['SIGDUMP_PATH'] =
|
|
410
|
+
ENV['SIGDUMP_PATH'] = @tmp_dir + "/sigdump.log"
|
|
409
411
|
|
|
410
412
|
server = DummyServer.new
|
|
411
413
|
def server.config
|
|
@@ -423,7 +425,7 @@ class SupervisorTest < ::Test::Unit::TestCase
|
|
|
423
425
|
server.stop_windows_event_thread
|
|
424
426
|
end
|
|
425
427
|
|
|
426
|
-
result_filepaths = Dir.glob("#{
|
|
428
|
+
result_filepaths = Dir.glob("#{@tmp_dir}/*")
|
|
427
429
|
assert {result_filepaths.length > 0}
|
|
428
430
|
ensure
|
|
429
431
|
ENV.delete('SIGDUMP_PATH')
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fluentd
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.16.
|
|
4
|
+
version: 1.16.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sadayuki Furuhashi
|
|
@@ -213,6 +213,48 @@ dependencies:
|
|
|
213
213
|
- - "<"
|
|
214
214
|
- !ruby/object:Gem::Version
|
|
215
215
|
version: '1.24'
|
|
216
|
+
- !ruby/object:Gem::Dependency
|
|
217
|
+
name: base64
|
|
218
|
+
requirement: !ruby/object:Gem::Requirement
|
|
219
|
+
requirements:
|
|
220
|
+
- - "~>"
|
|
221
|
+
- !ruby/object:Gem::Version
|
|
222
|
+
version: '0.2'
|
|
223
|
+
type: :runtime
|
|
224
|
+
prerelease: false
|
|
225
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
226
|
+
requirements:
|
|
227
|
+
- - "~>"
|
|
228
|
+
- !ruby/object:Gem::Version
|
|
229
|
+
version: '0.2'
|
|
230
|
+
- !ruby/object:Gem::Dependency
|
|
231
|
+
name: csv
|
|
232
|
+
requirement: !ruby/object:Gem::Requirement
|
|
233
|
+
requirements:
|
|
234
|
+
- - "~>"
|
|
235
|
+
- !ruby/object:Gem::Version
|
|
236
|
+
version: '3.2'
|
|
237
|
+
type: :runtime
|
|
238
|
+
prerelease: false
|
|
239
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
240
|
+
requirements:
|
|
241
|
+
- - "~>"
|
|
242
|
+
- !ruby/object:Gem::Version
|
|
243
|
+
version: '3.2'
|
|
244
|
+
- !ruby/object:Gem::Dependency
|
|
245
|
+
name: drb
|
|
246
|
+
requirement: !ruby/object:Gem::Requirement
|
|
247
|
+
requirements:
|
|
248
|
+
- - "~>"
|
|
249
|
+
- !ruby/object:Gem::Version
|
|
250
|
+
version: '2.2'
|
|
251
|
+
type: :runtime
|
|
252
|
+
prerelease: false
|
|
253
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
254
|
+
requirements:
|
|
255
|
+
- - "~>"
|
|
256
|
+
- !ruby/object:Gem::Version
|
|
257
|
+
version: '2.2'
|
|
216
258
|
- !ruby/object:Gem::Dependency
|
|
217
259
|
name: logger
|
|
218
260
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -983,7 +1025,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
983
1025
|
- !ruby/object:Gem::Version
|
|
984
1026
|
version: '0'
|
|
985
1027
|
requirements: []
|
|
986
|
-
rubygems_version: 3.6.
|
|
1028
|
+
rubygems_version: 3.6.9
|
|
987
1029
|
specification_version: 4
|
|
988
1030
|
summary: Fluentd event collector
|
|
989
1031
|
test_files:
|