fluentd 1.8.1-x86-mingw32 → 1.9.0-x86-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 +4 -4
- data/.gitlab-ci.yml +14 -58
- data/.travis.yml +2 -17
- data/CHANGELOG.md +39 -0
- data/Gemfile +1 -4
- data/README.md +2 -6
- data/fluentd.gemspec +6 -6
- data/lib/fluent/command/cat.rb +1 -3
- data/lib/fluent/command/plugin_generator.rb +2 -1
- data/lib/fluent/config.rb +19 -0
- data/lib/fluent/config/literal_parser.rb +13 -8
- data/lib/fluent/config/v1_parser.rb +5 -3
- data/lib/fluent/engine.rb +60 -9
- data/lib/fluent/ext_monitor_require.rb +28 -0
- data/lib/fluent/load.rb +1 -1
- data/lib/fluent/msgpack_factory.rb +16 -4
- data/lib/fluent/plugin/base.rb +5 -0
- data/lib/fluent/plugin/buf_file.rb +10 -6
- data/lib/fluent/plugin/buf_file_single.rb +10 -6
- data/lib/fluent/plugin/buffer.rb +40 -22
- data/lib/fluent/plugin/buffer/chunk.rb +1 -1
- data/lib/fluent/plugin/in_http.rb +9 -9
- data/lib/fluent/plugin/in_tail.rb +8 -6
- data/lib/fluent/plugin/out_http.rb +2 -2
- data/lib/fluent/plugin/output.rb +2 -2
- data/lib/fluent/plugin/parser.rb +6 -0
- data/lib/fluent/plugin_helper/http_server.rb +0 -1
- data/lib/fluent/plugin_helper/record_accessor.rb +0 -8
- data/lib/fluent/plugin_helper/server.rb +6 -21
- data/lib/fluent/plugin_id.rb +9 -4
- data/lib/fluent/static_config_analysis.rb +194 -0
- data/lib/fluent/supervisor.rb +103 -28
- data/lib/fluent/system_config.rb +2 -1
- data/lib/fluent/test/driver/base.rb +4 -3
- data/lib/fluent/variable_store.rb +40 -0
- data/lib/fluent/version.rb +1 -1
- data/test/config/test_config_parser.rb +19 -16
- data/test/config/test_system_config.rb +6 -4
- data/test/plugin/test_in_exec.rb +9 -9
- data/test/plugin/test_in_forward.rb +10 -11
- data/test/plugin/test_in_http.rb +35 -3
- data/test/plugin/test_in_object_space.rb +3 -7
- data/test/plugin/test_out_exec_filter.rb +28 -45
- data/test/plugin/test_out_forward.rb +2 -2
- data/test/plugin/test_out_http.rb +8 -2
- data/test/plugin/test_output.rb +3 -3
- data/test/plugin/test_output_as_buffered.rb +1 -1
- data/test/plugin/test_output_as_buffered_overflow.rb +1 -1
- data/test/plugin/test_output_as_buffered_secondary.rb +2 -2
- data/test/plugin_helper/test_child_process.rb +45 -56
- data/test/plugin_helper/test_server.rb +13 -0
- data/test/plugin_helper/test_timer.rb +11 -13
- data/test/test_config.rb +27 -5
- data/test/test_engine.rb +203 -0
- data/test/test_output.rb +2 -2
- data/test/test_static_config_analysis.rb +177 -0
- data/test/test_supervisor.rb +18 -80
- data/test/test_test_drivers.rb +4 -3
- data/test/test_variable_store.rb +65 -0
- metadata +40 -27
- data/.gitlab/cicd-template.yaml +0 -10
- data/Vagrantfile +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c012a28dff140583d26c6cdf490dd3efdeedb5e502f3f6764796ff7415298385
|
4
|
+
data.tar.gz: e1bcdebb3998dfc297e60cddf9fa1c0db4079595169610b3088927a61c1d6d32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc4fb419d9a30830881e7dc5a563f7d19030008f5bac3452cb1549da6860aa58b28bec8b9bcb2e2c8b41a744ff1de1c713ff8235343e2154531ecbed09344bdd
|
7
|
+
data.tar.gz: 49553765cf43ab3094962306f4abfdf2c23b8da8695756702f2a1855b834130bf195a2ceaa39e48bb030680c480133129ff99125280840de3896208362765ef3
|
data/.gitlab-ci.yml
CHANGED
@@ -1,38 +1,22 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
.install-template:
|
2
|
+
before_script:
|
3
|
+
- gem update --system=2.7.8
|
4
|
+
- ruby -v
|
5
|
+
|
6
|
+
.test-template:
|
7
|
+
before_script:
|
8
|
+
- gem install rake
|
9
|
+
- bundle install
|
10
|
+
- chmod 777 -R ./test
|
3
11
|
|
4
12
|
stages:
|
5
13
|
- build
|
6
14
|
- tests
|
7
15
|
|
8
|
-
2-1-10:
|
9
|
-
image: "ruby:2.1.10"
|
10
|
-
stage: build
|
11
|
-
allow_failure: true
|
12
|
-
extends: .install-template
|
13
|
-
script:
|
14
|
-
- bundle install --jobs=3 --retry=3
|
15
|
-
cache:
|
16
|
-
key: "$CI_COMMIT_REF_SLUG 2-1-10"
|
17
|
-
paths:
|
18
|
-
- ./*
|
19
|
-
|
20
|
-
2-2-10:
|
21
|
-
image: "ruby:2.2.10"
|
22
|
-
stage: build
|
23
|
-
allow_failure: true
|
24
|
-
extends: .install-template
|
25
|
-
script:
|
26
|
-
- bundle install --jobs=3 --retry=3
|
27
|
-
cache:
|
28
|
-
key: "$CI_COMMIT_REF_SLUG 2-2-10"
|
29
|
-
paths:
|
30
|
-
|
31
16
|
2-4-5:
|
32
17
|
image: "ruby:2.4.5"
|
33
18
|
stage: build
|
34
|
-
|
35
|
-
extends: .install-template
|
19
|
+
extends: .install-template
|
36
20
|
script:
|
37
21
|
- bundle install --jobs=3 --retry=3
|
38
22
|
cache:
|
@@ -42,8 +26,7 @@ stages:
|
|
42
26
|
2-5-5:
|
43
27
|
image: "ruby:2.5.5"
|
44
28
|
stage: build
|
45
|
-
|
46
|
-
extends: .install-template
|
29
|
+
extends: .install-template
|
47
30
|
script:
|
48
31
|
- bundle install --jobs=3 --retry=3
|
49
32
|
cache:
|
@@ -53,8 +36,7 @@ stages:
|
|
53
36
|
2-6-3:
|
54
37
|
image: "ruby:2.6.3"
|
55
38
|
stage: build
|
56
|
-
|
57
|
-
extends: .install-template
|
39
|
+
extends: .install-template
|
58
40
|
script:
|
59
41
|
- bundle install --jobs=3 --retry=3
|
60
42
|
cache:
|
@@ -64,8 +46,7 @@ stages:
|
|
64
46
|
rubyhead:
|
65
47
|
image: "ruby:latest"
|
66
48
|
stage: build
|
67
|
-
|
68
|
-
extends: .install-template
|
49
|
+
extends: .install-template
|
69
50
|
script:
|
70
51
|
- bundle install --jobs=3 --retry=3
|
71
52
|
cache:
|
@@ -73,30 +54,6 @@ rubyhead:
|
|
73
54
|
paths:
|
74
55
|
- ./*
|
75
56
|
|
76
|
-
2-1-10-test:
|
77
|
-
image: "ruby:2.1.10"
|
78
|
-
stage: tests
|
79
|
-
allow_failure: true
|
80
|
-
extends: .test-template
|
81
|
-
script:
|
82
|
-
- bundle exec rake test
|
83
|
-
cache:
|
84
|
-
key: "$CI_COMMIT_REF_SLUG 2-1-10"
|
85
|
-
paths:
|
86
|
-
- ./*
|
87
|
-
|
88
|
-
2-2-10-test:
|
89
|
-
image: "ruby:2.2.10"
|
90
|
-
stage: tests
|
91
|
-
allow_failure: true
|
92
|
-
extends: .test-template
|
93
|
-
script:
|
94
|
-
- bundle exec rake test
|
95
|
-
cache:
|
96
|
-
key: "$CI_COMMIT_REF_SLUG 2-2-10"
|
97
|
-
paths:
|
98
|
-
- ./*
|
99
|
-
|
100
57
|
2-4-5-test:
|
101
58
|
image: "ruby:2.4.5"
|
102
59
|
stage: tests
|
@@ -144,4 +101,3 @@ rubyhead-test:
|
|
144
101
|
key: "$CI_COMMIT_REF_SLUG latest"
|
145
102
|
paths:
|
146
103
|
- ./*
|
147
|
-
|
data/.travis.yml
CHANGED
@@ -7,12 +7,6 @@ cache: bundler
|
|
7
7
|
# See here for osx_image -> OSX versions: https://docs.travis-ci.com/user/languages/objective-c
|
8
8
|
matrix:
|
9
9
|
include:
|
10
|
-
- rvm: 2.1.10
|
11
|
-
os: linux
|
12
|
-
- rvm: 2.2.10
|
13
|
-
os: linux
|
14
|
-
- rvm: 2.2.10
|
15
|
-
os: linux-ppc64le
|
16
10
|
- rvm: 2.4.9
|
17
11
|
os: linux
|
18
12
|
- rvm: 2.4.9
|
@@ -25,13 +19,12 @@ matrix:
|
|
25
19
|
dist: xenial
|
26
20
|
- rvm: 2.6.5
|
27
21
|
os: linux
|
22
|
+
- rvm: 2.7.0
|
23
|
+
os: linux
|
28
24
|
- rvm: ruby-head
|
29
25
|
os: linux
|
30
26
|
- rvm: ruby-head
|
31
27
|
os: linux-ppc64le
|
32
|
-
- rvm: 2.1.10
|
33
|
-
os: osx
|
34
|
-
osx_image: xcode8.3 # OSX 10.12
|
35
28
|
- rvm: 2.4.6
|
36
29
|
os: osx
|
37
30
|
osx_image: xcode8.3 # OSX 10.12
|
@@ -39,9 +32,6 @@ matrix:
|
|
39
32
|
os: osx
|
40
33
|
osx_image: xcode8.3 # OSX 10.12
|
41
34
|
allow_failures:
|
42
|
-
- rvm: 2.1.10
|
43
|
-
os: osx
|
44
|
-
osx_image: xcode8.3
|
45
35
|
- rvm: 2.4.6
|
46
36
|
os: osx
|
47
37
|
osx_image: xcode8.3
|
@@ -54,11 +44,6 @@ matrix:
|
|
54
44
|
branches:
|
55
45
|
only:
|
56
46
|
- master
|
57
|
-
- v0.12
|
58
|
-
- v0.14
|
59
|
-
|
60
|
-
before_install:
|
61
|
-
- gem update --system=2.7.8
|
62
47
|
|
63
48
|
sudo: false
|
64
49
|
dist: trusty # for TLSv1.2 support
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,42 @@
|
|
1
|
+
# v1.9
|
2
|
+
|
3
|
+
## Release v1.9.0 - 2020/01/22
|
4
|
+
|
5
|
+
### New feature
|
6
|
+
|
7
|
+
* New light-weight config reload mechanizm
|
8
|
+
https://github.com/fluent/fluentd/pull/2716
|
9
|
+
* Drop ruby 2.1/2.2/2.3 support
|
10
|
+
https://github.com/fluent/fluentd/pull/2750
|
11
|
+
|
12
|
+
### Enhancement
|
13
|
+
|
14
|
+
* output: Show better message for secondary warning
|
15
|
+
https://github.com/fluent/fluentd/pull/2751
|
16
|
+
* Use `ext_monitor` gem if it is installed. For ruby 2.6 or earlier
|
17
|
+
https://github.com/fluent/fluentd/pull/2670
|
18
|
+
* Support Ruby's Time class in msgpack serde
|
19
|
+
https://github.com/fluent/fluentd/pull/2775
|
20
|
+
* Clean up code/test
|
21
|
+
https://github.com/fluent/fluentd/pull/2753
|
22
|
+
https://github.com/fluent/fluentd/pull/2763
|
23
|
+
https://github.com/fluent/fluentd/pull/2764
|
24
|
+
https://github.com/fluent/fluentd/pull/2780
|
25
|
+
|
26
|
+
### Bug fix
|
27
|
+
|
28
|
+
* buffer: Disable the optimization of Metadata instance comparison on Windows
|
29
|
+
https://github.com/fluent/fluentd/pull/2778
|
30
|
+
* outut/buffer: Fix stage size computation
|
31
|
+
https://github.com/fluent/fluentd/pull/2734
|
32
|
+
* server: Ignore Errno::EHOSTUNREACH in TLS accept to avoid fluentd restart
|
33
|
+
https://github.com/fluent/fluentd/pull/2773
|
34
|
+
* server: Fix IPv6 dual stack mode issue for udp socket
|
35
|
+
https://github.com/fluent/fluentd/pull/2781
|
36
|
+
* config: Support @include/include directive for spaces included path
|
37
|
+
https://github.com/fluent/fluentd/pull/2780
|
38
|
+
|
39
|
+
|
1
40
|
# v1.8
|
2
41
|
|
3
42
|
## Release v1.8.1 - 2019/12/26
|
data/Gemfile
CHANGED
@@ -2,10 +2,7 @@ source 'https://rubygems.org/'
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
|
6
|
-
if Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('2.3.0')
|
7
|
-
gem 'async-http', '~> 0.42'
|
8
|
-
end
|
5
|
+
gem 'async-http', '~> 0.42'
|
9
6
|
|
10
7
|
local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")
|
11
8
|
if File.exist?(local_gemfile)
|
data/README.md
CHANGED
@@ -6,10 +6,6 @@ Travis CI:
|
|
6
6
|
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1189/badge)](https://bestpractices.coreinfrastructure.org/projects/1189)
|
7
7
|
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Ffluent%2Ffluentd.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Ffluent%2Ffluentd?ref=badge_shield)
|
8
8
|
|
9
|
-
GitLab CI:
|
10
|
-
|
11
|
-
[![pipeline status](https://gitlab.com/fluent/fluentd/badges/master/pipeline.svg)](https://gitlab.com/fluent/fluentd/commits/master)
|
12
|
-
|
13
9
|
Drone CI for Arm64:
|
14
10
|
|
15
11
|
[![pipeline status](https://cloud.drone.io/api/badges/fluent/fluentd/status.svg?branch=master)](https://cloud.drone.io/fluent/fluentd)
|
@@ -42,11 +38,11 @@ Mobile/Web Application Logging | Fluentd can function as middleware to enable as
|
|
42
38
|
### Branch
|
43
39
|
|
44
40
|
- master: For v1 development.
|
45
|
-
- v0.12: For v0.12. This is
|
41
|
+
- v0.12: For v0.12. This is deprecated version. we already stopped supporting (See https://www.fluentd.org/blog/drop-schedule-announcement-in-2019).
|
46
42
|
|
47
43
|
### Prerequisites
|
48
44
|
|
49
|
-
- Ruby 2.
|
45
|
+
- Ruby 2.4 or later
|
50
46
|
- git
|
51
47
|
|
52
48
|
`git` should be in `PATH`. On Windows, you can use `Github for Windows` and `GitShell` for easy setup.
|
data/fluentd.gemspec
CHANGED
@@ -16,9 +16,9 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.require_paths = ["lib"]
|
17
17
|
gem.license = "Apache-2.0"
|
18
18
|
|
19
|
-
gem.required_ruby_version = '>= 2.
|
19
|
+
gem.required_ruby_version = '>= 2.4'
|
20
20
|
|
21
|
-
gem.add_runtime_dependency("msgpack", [">= 1.
|
21
|
+
gem.add_runtime_dependency("msgpack", [">= 1.3.1", "< 2.0.0"])
|
22
22
|
gem.add_runtime_dependency("yajl-ruby", ["~> 1.0"])
|
23
23
|
gem.add_runtime_dependency("cool.io", [">= 1.4.5", "< 2.0.0"])
|
24
24
|
gem.add_runtime_dependency("serverengine", [">= 2.0.4", "< 3.0.0"])
|
@@ -27,7 +27,6 @@ Gem::Specification.new do |gem|
|
|
27
27
|
gem.add_runtime_dependency("tzinfo", [">= 1.0", "< 3.0"])
|
28
28
|
gem.add_runtime_dependency("tzinfo-data", ["~> 1.0"])
|
29
29
|
gem.add_runtime_dependency("strptime", [">= 0.2.2", "< 1.0.0"])
|
30
|
-
gem.add_runtime_dependency("dig_rb", ["~> 1.0.0"])
|
31
30
|
|
32
31
|
# build gem for a certain platform. see also Rakefile
|
33
32
|
fake_platform = ENV['GEM_BUILD_FAKE_PLATFORM'].to_s
|
@@ -40,13 +39,14 @@ Gem::Specification.new do |gem|
|
|
40
39
|
gem.add_runtime_dependency("certstore_c", ["~> 0.1.2"])
|
41
40
|
end
|
42
41
|
|
43
|
-
gem.add_development_dependency("rake", ["~>
|
42
|
+
gem.add_development_dependency("rake", ["~> 13.0"])
|
44
43
|
gem.add_development_dependency("flexmock", ["~> 2.0"])
|
45
44
|
gem.add_development_dependency("parallel_tests", ["~> 0.15.3"])
|
46
45
|
gem.add_development_dependency("simplecov", ["~> 0.7"])
|
47
46
|
gem.add_development_dependency("rr", ["~> 1.0"])
|
48
|
-
gem.add_development_dependency("timecop", ["~> 0.
|
49
|
-
gem.add_development_dependency("test-unit", ["~> 3.
|
47
|
+
gem.add_development_dependency("timecop", ["~> 0.9"])
|
48
|
+
gem.add_development_dependency("test-unit", ["~> 3.3"])
|
50
49
|
gem.add_development_dependency("test-unit-rr", ["~> 1.0"])
|
51
50
|
gem.add_development_dependency("oj", [">= 2.14", "< 4"])
|
51
|
+
gem.add_development_dependency("ext_monitor", [">= 0.1.1", "< 0.2"])
|
52
52
|
end
|
data/lib/fluent/command/cat.rb
CHANGED
@@ -101,13 +101,11 @@ rescue
|
|
101
101
|
usage $!.to_s
|
102
102
|
end
|
103
103
|
|
104
|
-
|
105
104
|
require 'thread'
|
106
|
-
require 'monitor'
|
107
105
|
require 'socket'
|
108
106
|
require 'yajl'
|
109
107
|
require 'msgpack'
|
110
|
-
|
108
|
+
require 'fluent/ext_monitor_require'
|
111
109
|
|
112
110
|
class Writer
|
113
111
|
include MonitorMixin
|
data/lib/fluent/config.rb
CHANGED
@@ -20,6 +20,25 @@ require 'fluent/configurable'
|
|
20
20
|
|
21
21
|
module Fluent
|
22
22
|
module Config
|
23
|
+
# @param config_path [String] config file path
|
24
|
+
# @param encoding [String] encoding of config file
|
25
|
+
# @param additional_config [String] config which is added to last of config body
|
26
|
+
# @param use_v1_config [Bool] config is formatted with v1 or not
|
27
|
+
# @return [Fluent::Config]
|
28
|
+
def self.build(config_path:, encoding: 'utf-8', additional_config: nil, use_v1_config: true)
|
29
|
+
config_fname = File.basename(config_path)
|
30
|
+
config_basedir = File.dirname(config_path)
|
31
|
+
config_data = File.open(config_path, "r:#{encoding}:utf-8") do |f|
|
32
|
+
s = f.read
|
33
|
+
if additional_config
|
34
|
+
c = additional_config.gsub("\\n", "\n")
|
35
|
+
s += "\n#{c}"
|
36
|
+
end
|
37
|
+
s
|
38
|
+
end
|
39
|
+
Fluent::Config.parse(config_data, config_fname, config_basedir, use_v1_config)
|
40
|
+
end
|
41
|
+
|
23
42
|
def self.parse(str, fname, basepath = Dir.pwd, v1_config = nil, syntax: :v1)
|
24
43
|
parser = if fname =~ /\.rb$/ || syntax == :ruby
|
25
44
|
:ruby
|
@@ -19,7 +19,7 @@ require 'stringio'
|
|
19
19
|
require 'json'
|
20
20
|
require 'yajl'
|
21
21
|
require 'socket'
|
22
|
-
require '
|
22
|
+
require 'ripper'
|
23
23
|
|
24
24
|
require 'fluent/config/basic_parser'
|
25
25
|
|
@@ -155,15 +155,20 @@ module Fluent
|
|
155
155
|
end
|
156
156
|
|
157
157
|
def scan_embedded_code
|
158
|
-
|
159
|
-
src = '"#{'+@ss.rest+"\n=end\n}"
|
158
|
+
src = '"#{'+@ss.rest+"\n=begin\n=end\n}"
|
160
159
|
|
161
|
-
|
162
|
-
|
163
|
-
|
160
|
+
seek = -1
|
161
|
+
while (seek = src.index('}', seek + 1))
|
162
|
+
unless Ripper.sexp(src[0..seek] + '"').nil? # eager parsing until valid expression
|
163
|
+
break
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
unless seek
|
168
|
+
raise Fluent::ConfigParseError, @ss.rest
|
169
|
+
end
|
164
170
|
|
165
|
-
|
166
|
-
code = src[3,tk.seek-3]
|
171
|
+
code = src[3, seek-3]
|
167
172
|
|
168
173
|
if @ss.rest.length < code.length
|
169
174
|
@ss.pos += @ss.rest.length
|
@@ -147,11 +147,13 @@ module Fluent
|
|
147
147
|
end
|
148
148
|
|
149
149
|
def eval_include(attrs, elems, uri)
|
150
|
-
|
151
|
-
|
150
|
+
# replace space(s)(' ') with '+' to prevent invalid uri due to space(s).
|
151
|
+
# See: https://github.com/fluent/fluentd/pull/2780#issuecomment-576081212
|
152
|
+
u = URI.parse(uri.gsub(/ /, '+'))
|
153
|
+
if u.scheme == 'file' || (!u.scheme.nil? && u.scheme.length == 1) || u.path == uri.gsub(/ /, '+') # file path
|
152
154
|
# When the Windows absolute path then u.scheme.length == 1
|
153
155
|
# e.g. C:
|
154
|
-
path = u.path
|
156
|
+
path = URI.decode_www_form_component(u.path)
|
155
157
|
if path[0] != ?/
|
156
158
|
pattern = File.expand_path("#{@include_basepath}/#{path}")
|
157
159
|
else
|
data/lib/fluent/engine.rb
CHANGED
@@ -23,6 +23,7 @@ require 'fluent/time'
|
|
23
23
|
require 'fluent/system_config'
|
24
24
|
require 'fluent/plugin'
|
25
25
|
require 'fluent/fluent_log_event_router'
|
26
|
+
require 'fluent/static_config_analysis'
|
26
27
|
|
27
28
|
module Fluent
|
28
29
|
class EngineClass
|
@@ -157,14 +158,47 @@ module Fluent
|
|
157
158
|
raise
|
158
159
|
end
|
159
160
|
|
160
|
-
|
161
|
-
|
162
|
-
|
161
|
+
stop_phase(@root_agent)
|
162
|
+
end
|
163
|
+
|
164
|
+
# @param conf [Fluent::Config]
|
165
|
+
# @param supervisor [Bool]
|
166
|
+
# @reutrn nil
|
167
|
+
def reload_config(conf, supervisor: false)
|
168
|
+
# configure first to reduce down time while restarting
|
169
|
+
new_agent = RootAgent.new(log: log, system_config: @system_config)
|
170
|
+
ret = Fluent::StaticConfigAnalysis.call(conf, workers: system_config.workers)
|
171
|
+
|
172
|
+
ret.all_plugins.each do |plugin|
|
173
|
+
if plugin.respond_to?(:reloadable_plugin?) && !plugin.reloadable_plugin?
|
174
|
+
raise Fluent::ConfigError, "Unreloadable plugin plugin: #{Fluent::Plugin.lookup_type_from_class(plugin.class)}, plugin_id: #{plugin.plugin_id}, class_name: #{plugin.class})"
|
175
|
+
end
|
163
176
|
end
|
164
|
-
$log.info "shutting down fluentd worker", worker: worker_id
|
165
|
-
shutdown
|
166
177
|
|
167
|
-
@
|
178
|
+
# Assign @root_agent to new root_agent
|
179
|
+
# for https://github.com/fluent/fluentd/blob/fcef949ce40472547fde295ddd2cfe297e1eddd6/lib/fluent/plugin_helper/event_emitter.rb#L50
|
180
|
+
old_agent, @root_agent = @root_agent, new_agent
|
181
|
+
begin
|
182
|
+
@root_agent.configure(conf)
|
183
|
+
rescue
|
184
|
+
@root_agent = old_agent
|
185
|
+
raise
|
186
|
+
end
|
187
|
+
|
188
|
+
unless @suppress_config_dump
|
189
|
+
$log.info :supervisor, "using configuration file: #{conf.to_s.rstrip}"
|
190
|
+
end
|
191
|
+
|
192
|
+
# supervisor doesn't handle actual data. so the following code is unnecessary.
|
193
|
+
if supervisor
|
194
|
+
old_agent.shutdown # to close thread created in #configure
|
195
|
+
return
|
196
|
+
end
|
197
|
+
|
198
|
+
stop_phase(old_agent)
|
199
|
+
|
200
|
+
$log.info 'restart fluentd worker', worker: worker_id
|
201
|
+
start_phase(new_agent)
|
168
202
|
end
|
169
203
|
|
170
204
|
def stop
|
@@ -189,12 +223,29 @@ module Fluent
|
|
189
223
|
end
|
190
224
|
|
191
225
|
private
|
192
|
-
|
226
|
+
|
227
|
+
def stop_phase(root_agent)
|
228
|
+
unless @log_event_verbose
|
229
|
+
$log.enable_event(false)
|
230
|
+
@fluent_log_event_router.graceful_stop
|
231
|
+
end
|
232
|
+
$log.info 'shutting down fluentd worker', worker: worker_id
|
233
|
+
root_agent.shutdown
|
234
|
+
|
235
|
+
@fluent_log_event_router.stop
|
236
|
+
end
|
237
|
+
|
238
|
+
def start_phase(root_agent)
|
239
|
+
@fluent_log_event_router = FluentLogEventRouter.build(root_agent)
|
240
|
+
if @fluent_log_event_router.emittable?
|
241
|
+
$log.enable_event(true)
|
242
|
+
end
|
243
|
+
|
193
244
|
@root_agent.start
|
194
245
|
end
|
195
246
|
|
196
|
-
def
|
197
|
-
@root_agent.
|
247
|
+
def start
|
248
|
+
@root_agent.start
|
198
249
|
end
|
199
250
|
end
|
200
251
|
|