fluentd 1.15.2-x64-mingw-ucrt → 1.16.0-x64-mingw-ucrt

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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/linux-test.yaml +2 -2
  3. data/.github/workflows/macos-test.yaml +2 -2
  4. data/.github/workflows/windows-test.yaml +2 -2
  5. data/CHANGELOG.md +96 -0
  6. data/MAINTAINERS.md +2 -0
  7. data/README.md +0 -1
  8. data/fluentd.gemspec +2 -2
  9. data/lib/fluent/command/fluentd.rb +55 -64
  10. data/lib/fluent/config/yaml_parser/loader.rb +18 -1
  11. data/lib/fluent/daemon.rb +2 -4
  12. data/lib/fluent/file_wrapper.rb +137 -0
  13. data/lib/fluent/log/console_adapter.rb +66 -0
  14. data/lib/fluent/log.rb +35 -5
  15. data/lib/fluent/oj_options.rb +1 -2
  16. data/lib/fluent/plugin/base.rb +5 -7
  17. data/lib/fluent/plugin/buf_file.rb +32 -3
  18. data/lib/fluent/plugin/buf_file_single.rb +32 -3
  19. data/lib/fluent/plugin/buffer/file_chunk.rb +1 -1
  20. data/lib/fluent/plugin/buffer.rb +21 -0
  21. data/lib/fluent/plugin/in_tail.rb +1 -6
  22. data/lib/fluent/plugin/in_tcp.rb +4 -2
  23. data/lib/fluent/plugin/out_file.rb +0 -4
  24. data/lib/fluent/plugin/out_forward/ack_handler.rb +19 -4
  25. data/lib/fluent/plugin/out_forward.rb +2 -2
  26. data/lib/fluent/plugin/out_secondary_file.rb +39 -22
  27. data/lib/fluent/plugin/output.rb +49 -12
  28. data/lib/fluent/plugin_helper/http_server/server.rb +2 -1
  29. data/lib/fluent/supervisor.rb +157 -232
  30. data/lib/fluent/test/driver/base.rb +11 -5
  31. data/lib/fluent/test/driver/filter.rb +4 -0
  32. data/lib/fluent/test/startup_shutdown.rb +6 -8
  33. data/lib/fluent/version.rb +1 -1
  34. data/test/command/test_ctl.rb +1 -1
  35. data/test/command/test_fluentd.rb +168 -22
  36. data/test/command/test_plugin_config_formatter.rb +0 -1
  37. data/test/compat/test_parser.rb +5 -5
  38. data/test/config/test_system_config.rb +0 -8
  39. data/test/log/test_console_adapter.rb +110 -0
  40. data/test/plugin/out_forward/test_ack_handler.rb +39 -0
  41. data/test/plugin/test_base.rb +98 -0
  42. data/test/plugin/test_buf_file.rb +62 -23
  43. data/test/plugin/test_buf_file_single.rb +65 -0
  44. data/test/plugin/test_in_http.rb +2 -3
  45. data/test/plugin/test_in_monitor_agent.rb +2 -3
  46. data/test/plugin/test_in_tail.rb +105 -103
  47. data/test/plugin/test_in_tcp.rb +15 -0
  48. data/test/plugin/test_out_file.rb +3 -2
  49. data/test/plugin/test_out_forward.rb +14 -18
  50. data/test/plugin/test_out_http.rb +1 -0
  51. data/test/plugin/test_output.rb +269 -0
  52. data/test/plugin/test_parser_regexp.rb +1 -6
  53. data/test/plugin_helper/test_http_server_helper.rb +1 -1
  54. data/test/plugin_helper/test_server.rb +10 -5
  55. data/test/test_config.rb +57 -21
  56. data/test/{plugin/test_file_wrapper.rb → test_file_wrapper.rb} +2 -2
  57. data/test/test_formatter.rb +23 -20
  58. data/test/test_log.rb +85 -40
  59. data/test/test_supervisor.rb +300 -283
  60. metadata +15 -24
  61. data/.drone.yml +0 -35
  62. data/.github/workflows/issue-auto-closer.yml +0 -12
  63. data/.github/workflows/stale-actions.yml +0 -22
  64. data/.gitlab-ci.yml +0 -103
  65. data/lib/fluent/plugin/file_wrapper.rb +0 -131
  66. data/test/test_logger_initializer.rb +0 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 490bfb0bfe2d6f8e60679aa4c9f5c28979f5003f8917f5990851d4731807dcb5
4
- data.tar.gz: 36d6d520218ce2b6b4823a0ff7acc9c6aed513875f2bc357f7519c5e9ee51759
3
+ metadata.gz: f9e448700741217b09469f92b1a37561487c01c9c7ecfd076cb8e62d4af9666d
4
+ data.tar.gz: d6931b08a3b5d3f1682c98616ecf98a68b54626232d9353af23db8294ef05f4f
5
5
  SHA512:
6
- metadata.gz: 26fd320d3e6d8da3e91c5669f91de5e2a8ba1713a17ef7227acaa198023e0f9e02ce913d6d078b60034f6de38c8f05196b818aa4839f57911c674c9ec3f47e57
7
- data.tar.gz: e2a9e6ecad1c88aa922eac83bef5d4e14eecb3d3f60eb158c169a40316762b2aaf5ff6851e6a1d9a150852cf420e46ec160460aca1137907b1599097b4708861
6
+ metadata.gz: 4f0e946b11ad1e975a3377df0635ab806edd2a2bb7acd1d09116362c209ac3a8c57eaf39d9c9436ad5dc71f2d7dab00350d085de6e70e3daec559a0171eab06d
7
+ data.tar.gz: f49a6aa1450a15469968fe76261e530ef6d4b166719e4ae4ac2c67bed0273738c5d7e5e476c0c63bf259ed0d691bc96a3227d168486f2dfaac201338dd734111
@@ -13,7 +13,7 @@ jobs:
13
13
  strategy:
14
14
  fail-fast: false
15
15
  matrix:
16
- ruby-version: ['3.1', '3.0', '2.7']
16
+ ruby-version: ['3.2', '3.1', '3.0', '2.7']
17
17
  os: [ubuntu-latest]
18
18
  experimental: [false]
19
19
  include:
@@ -23,7 +23,7 @@ jobs:
23
23
 
24
24
  name: Unit testing with Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}
25
25
  steps:
26
- - uses: actions/checkout@v2
26
+ - uses: actions/checkout@v3
27
27
  - name: Set up Ruby
28
28
  uses: ruby/setup-ruby@v1
29
29
  with:
@@ -13,7 +13,7 @@ jobs:
13
13
  strategy:
14
14
  fail-fast: false
15
15
  matrix:
16
- ruby-version: ['3.1', '3.0', '2.7']
16
+ ruby-version: ['3.2', '3.1', '3.0', '2.7']
17
17
  os: [macos-latest]
18
18
  experimental: [true]
19
19
  include:
@@ -23,7 +23,7 @@ jobs:
23
23
 
24
24
  name: Unit testing with Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}
25
25
  steps:
26
- - uses: actions/checkout@v2
26
+ - uses: actions/checkout@v3
27
27
  - name: Set up Ruby
28
28
  uses: ruby/setup-ruby@v1
29
29
  with:
@@ -13,7 +13,7 @@ jobs:
13
13
  strategy:
14
14
  fail-fast: false
15
15
  matrix:
16
- ruby-version: ['3.1', '2.7']
16
+ ruby-version: ['3.2', '3.1', '2.7']
17
17
  os:
18
18
  - windows-latest
19
19
  experimental: [false]
@@ -35,7 +35,7 @@ jobs:
35
35
 
36
36
  name: Unit testing with Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}
37
37
  steps:
38
- - uses: actions/checkout@v2
38
+ - uses: actions/checkout@v3
39
39
  - name: Set up Ruby
40
40
  uses: ruby/setup-ruby@v1
41
41
  with:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,101 @@
1
+ # v1.16
2
+
3
+ ## Release v1.16.0 - 2023/03/29
4
+
5
+ ### Enhancement
6
+
7
+ * in_tcp: Add `send_keepalive_packet` option
8
+ https://github.com/fluent/fluentd/pull/3961
9
+ * buffer: backup broken file chunk
10
+ https://github.com/fluent/fluentd/pull/4025
11
+ * Add warning messages for restoring buffer with `flush_at_shutdown true`
12
+ https://github.com/fluent/fluentd/pull/4027
13
+ * Add logs for time period of restored buffer possibly broken
14
+ https://github.com/fluent/fluentd/pull/4028
15
+
16
+ ### Bug Fix
17
+
18
+ * http_server_helper: Fix format of log messages originating from Async gem
19
+ https://github.com/fluent/fluentd/pull/3987
20
+ * Change to not generate a sigdump file after receiving a `SIGTERM` signal on
21
+ non-Windows
22
+ https://github.com/fluent/fluentd/pull/4034
23
+ https://github.com/fluent/fluentd/pull/4043
24
+ * out_forward: fix error of ack handling conflict on stopping with
25
+ `require_ack_response` enabled
26
+ https://github.com/fluent/fluentd/pull/4030
27
+ * Fix problem that some `system` configs are not reflected
28
+ https://github.com/fluent/fluentd/pull/4064
29
+ https://github.com/fluent/fluentd/pull/4065
30
+ https://github.com/fluent/fluentd/pull/4086
31
+ https://github.com/fluent/fluentd/pull/4090
32
+ https://github.com/fluent/fluentd/pull/4096
33
+ * Fix bug that the logger outputs some initial log messages without applying
34
+ some settings such as `format`
35
+ https://github.com/fluent/fluentd/pull/4091
36
+ * Windows: Fix a bug that the wrong log file is reopened with log rotate setting
37
+ when flushing or graceful reloading
38
+ https://github.com/fluent/fluentd/pull/4054
39
+ * Fix race condition of out_secondary_file
40
+ https://github.com/fluent/fluentd/pull/4081
41
+ * Suppress warning using different secondary for out_secondary_file
42
+ https://github.com/fluent/fluentd/pull/4087
43
+ * Fix value of `system_config.workers` at `run_configure`.
44
+ Change argument type of `Fluent::Plugin::Base::configure()` to
45
+ `Fluent::Config::Element` only.
46
+ https://github.com/fluent/fluentd/pull/4066
47
+ * Fix bug that Fluentd sometimes tries to use an unavailable port and fails to
48
+ start on Windows
49
+ https://github.com/fluent/fluentd/pull/4092
50
+
51
+ ### Misc
52
+
53
+ * Add method for testing `filtered_with_time`
54
+ https://github.com/fluent/fluentd/pull/3899
55
+ * Replace `$$` with `Process.pid`
56
+ https://github.com/fluent/fluentd/pull/4040
57
+ * Relax required webric gem version
58
+ https://github.com/fluent/fluentd/pull/4061
59
+ * CI fixes to support Ruby 3.2
60
+ https://github.com/fluent/fluentd/pull/3968
61
+ https://github.com/fluent/fluentd/pull/3996
62
+ https://github.com/fluent/fluentd/pull/3997
63
+ * Other CI fixes
64
+ https://github.com/fluent/fluentd/pull/3969
65
+ https://github.com/fluent/fluentd/pull/3990
66
+ https://github.com/fluent/fluentd/pull/4013
67
+ https://github.com/fluent/fluentd/pull/4033
68
+ https://github.com/fluent/fluentd/pull/4044
69
+ https://github.com/fluent/fluentd/pull/4050
70
+ https://github.com/fluent/fluentd/pull/4062
71
+ https://github.com/fluent/fluentd/pull/4074
72
+ https://github.com/fluent/fluentd/pull/4082
73
+ https://github.com/fluent/fluentd/pull/4085
74
+ * Update MAINTAINERS.md
75
+ https://github.com/fluent/fluentd/pull/4026
76
+ https://github.com/fluent/fluentd/pull/4069
77
+
1
78
  # v1.15
2
79
 
80
+ ## Release v1.15.3 - 2022/11/02
81
+
82
+ ### Bug Fix
83
+
84
+ * Support glob for `!include` directive in YAML config format
85
+ https://github.com/fluent/fluentd/pull/3917
86
+ * Remove meaningless oj options
87
+ https://github.com/fluent/fluentd/pull/3929
88
+ * Fix log initializer to correctly create per-process files on Windows
89
+ https://github.com/fluent/fluentd/pull/3939
90
+ * out_file: Fix the multi-worker check with `<worker 0-N>` directive
91
+ https://github.com/fluent/fluentd/pull/3942
92
+
93
+ ### Misc
94
+
95
+ * Fix broken tests on Ruby 3.2
96
+ https://github.com/fluent/fluentd/pull/3883
97
+ https://github.com/fluent/fluentd/pull/3922
98
+
3
99
  ## Release v1.15.2 - 2022/08/22
4
100
 
5
101
  ### Enhancement
data/MAINTAINERS.md CHANGED
@@ -5,7 +5,9 @@
5
5
  - [Hiroshi Hatake](https://github.com/cosmo0920), [Calyptia](https://calyptia.com/)
6
6
  - [Masahiro Nakagawa](https://github.com/repeatedly), [Treasure Data](https://www.treasuredata.com/)
7
7
  - [Satoshi Tagomori](https://github.com/tagomoris), [Treasure Data](https://www.treasuredata.com/)
8
+ - [Toru Takahashi](https://github.com/toru-takahashi), [Treasure Data](https://www.treasuredata.com/)
8
9
  - [Eduardo Silva](https://github.com/edsiper), [Calyptia](https://calyptia/)
9
10
  - [Fujimoto Seiji](https://github.com/fujimots), [ClearCode](https://www.clear-code.com/)
10
11
  - [Takuro Ashie](https://github.com/ashie), [ClearCode](https://www.clear-code.com/)
11
12
  - [Kentaro Hayashi](https://github.com/kenhys), [ClearCode](https://www.clear-code.com/)
13
+ - [Daijiro Fukuda](https://github.com/daipom), [ClearCode](https://www.clear-code.com/)
data/README.md CHANGED
@@ -4,7 +4,6 @@ Fluentd: Open-Source Log Collector
4
4
  [![Testing on Ubuntu](https://github.com/fluent/fluentd/actions/workflows/linux-test.yaml/badge.svg?branch=master)](https://github.com/fluent/fluentd/actions/workflows/linux-test.yaml)
5
5
  [![Testing on Windows](https://github.com/fluent/fluentd/actions/workflows/windows-test.yaml/badge.svg?branch=master)](https://github.com/fluent/fluentd/actions/workflows/windows-test.yaml)
6
6
  [![Testing on macOS](https://github.com/fluent/fluentd/actions/workflows/macos-test.yaml/badge.svg?branch=master)](https://github.com/fluent/fluentd/actions/workflows/macos-test.yaml)
7
- [![Testing on Arm64](https://cloud.drone.io/api/badges/fluent/fluentd/status.svg?branch=master)](https://cloud.drone.io/fluent/fluentd)
8
7
  [![Code Climate](https://codeclimate.com/github/fluent/fluentd/badges/gpa.svg)](https://codeclimate.com/github/fluent/fluentd)
9
8
  [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1189/badge)](https://bestpractices.coreinfrastructure.org/projects/1189)
10
9
 
data/fluentd.gemspec CHANGED
@@ -22,13 +22,13 @@ Gem::Specification.new do |gem|
22
22
  gem.add_runtime_dependency("msgpack", [">= 1.3.1", "< 2.0.0"])
23
23
  gem.add_runtime_dependency("yajl-ruby", ["~> 1.0"])
24
24
  gem.add_runtime_dependency("cool.io", [">= 1.4.5", "< 2.0.0"])
25
- gem.add_runtime_dependency("serverengine", [">= 2.3.0", "< 3.0.0"])
25
+ gem.add_runtime_dependency("serverengine", [">= 2.3.2", "< 3.0.0"])
26
26
  gem.add_runtime_dependency("http_parser.rb", [">= 0.5.1", "< 0.9.0"])
27
27
  gem.add_runtime_dependency("sigdump", ["~> 0.2.2"])
28
28
  gem.add_runtime_dependency("tzinfo", [">= 1.0", "< 3.0"])
29
29
  gem.add_runtime_dependency("tzinfo-data", ["~> 1.0"])
30
30
  gem.add_runtime_dependency("strptime", [">= 0.2.4", "< 1.0.0"])
31
- gem.add_runtime_dependency("webrick", [">= 1.4.2", "< 1.8.0"])
31
+ gem.add_runtime_dependency("webrick", ["~> 1.4"])
32
32
 
33
33
  # build gem for a certain platform. see also Rakefile
34
34
  fake_platform = ENV['GEM_BUILD_FAKE_PLATFORM'].to_s
@@ -26,26 +26,27 @@ $fluentdargv = Marshal.load(Marshal.dump(ARGV))
26
26
  op = OptionParser.new
27
27
  op.version = Fluent::VERSION
28
28
 
29
- opts = Fluent::Supervisor.default_options
29
+ default_opts = Fluent::Supervisor.default_options
30
+ cmd_opts = {}
30
31
 
31
32
  op.on('-s', "--setup [DIR=#{File.dirname(Fluent::DEFAULT_CONFIG_PATH)}]", "install sample configuration file to the directory") {|s|
32
- opts[:setup_path] = s || File.dirname(Fluent::DEFAULT_CONFIG_PATH)
33
+ cmd_opts[:setup_path] = s || File.dirname(Fluent::DEFAULT_CONFIG_PATH)
33
34
  }
34
35
 
35
36
  op.on('-c', '--config PATH', "config file path (default: #{Fluent::DEFAULT_CONFIG_PATH})") {|s|
36
- opts[:config_path] = s
37
+ cmd_opts[:config_path] = s
37
38
  }
38
39
 
39
40
  op.on('--dry-run', "Check fluentd setup is correct or not", TrueClass) {|b|
40
- opts[:dry_run] = b
41
+ cmd_opts[:dry_run] = b
41
42
  }
42
43
 
43
44
  op.on('--show-plugin-config=PLUGIN', "[DEPRECATED] Show PLUGIN configuration and exit(ex: input:dummy)") {|plugin|
44
- opts[:show_plugin_config] = plugin
45
+ cmd_opts[:show_plugin_config] = plugin
45
46
  }
46
47
 
47
48
  op.on('-p', '--plugin DIR', "add plugin directory") {|s|
48
- opts[:plugin_dirs] << s
49
+ (cmd_opts[:plugin_dirs] ||= []) << s
49
50
  }
50
51
 
51
52
  op.on('-I PATH', "add library path") {|s|
@@ -53,48 +54,48 @@ op.on('-I PATH', "add library path") {|s|
53
54
  }
54
55
 
55
56
  op.on('-r NAME', "load library") {|s|
56
- opts[:libs] << s
57
+ (cmd_opts[:libs] ||= []) << s
57
58
  }
58
59
 
59
60
  op.on('-d', '--daemon PIDFILE', "daemonize fluent process") {|s|
60
- opts[:daemonize] = s
61
+ cmd_opts[:daemonize] = s
61
62
  }
62
63
 
63
64
  op.on('--under-supervisor', "run fluent worker under supervisor (this option is NOT for users)") {
64
- opts[:supervise] = false
65
+ cmd_opts[:supervise] = false
65
66
  }
66
67
 
67
68
  op.on('--no-supervisor', "run fluent worker without supervisor") {
68
- opts[:supervise] = false
69
- opts[:standalone_worker] = true
69
+ cmd_opts[:supervise] = false
70
+ cmd_opts[:standalone_worker] = true
70
71
  }
71
72
 
72
73
  op.on('--workers NUM', "specify the number of workers under supervisor") { |i|
73
- opts[:workers] = i.to_i
74
+ cmd_opts[:workers] = i.to_i
74
75
  }
75
76
 
76
77
  op.on('--user USER', "change user") {|s|
77
- opts[:chuser] = s
78
+ cmd_opts[:chuser] = s
78
79
  }
79
80
 
80
81
  op.on('--group GROUP', "change group") {|s|
81
- opts[:chgroup] = s
82
+ cmd_opts[:chgroup] = s
82
83
  }
83
84
 
84
85
  op.on('--umask UMASK', "change umask") {|s|
85
- opts[:chumask] = s
86
+ cmd_opts[:chumask] = s
86
87
  }
87
88
 
88
89
  op.on('-o', '--log PATH', "log file path") {|s|
89
- opts[:log_path] = s
90
+ cmd_opts[:log_path] = s
90
91
  }
91
92
 
92
93
  op.on('--log-rotate-age AGE', 'generations to keep rotated log files') {|age|
93
94
  if Fluent::Log::LOG_ROTATE_AGE.include?(age)
94
- opts[:log_rotate_age] = age
95
+ cmd_opts[:log_rotate_age] = age
95
96
  else
96
97
  begin
97
- opts[:log_rotate_age] = Integer(age)
98
+ cmd_opts[:log_rotate_age] = Integer(age)
98
99
  rescue TypeError, ArgumentError
99
100
  usage "log-rotate-age should be #{ROTATE_AGE.join(', ')} or a number"
100
101
  end
@@ -102,129 +103,129 @@ op.on('--log-rotate-age AGE', 'generations to keep rotated log files') {|age|
102
103
  }
103
104
 
104
105
  op.on('--log-rotate-size BYTES', 'sets the byte size to rotate log files') {|s|
105
- opts[:log_rotate_size] = s.to_i
106
+ cmd_opts[:log_rotate_size] = s.to_i
106
107
  }
107
108
 
108
109
  op.on('--log-event-verbose', 'enable log events during process startup/shutdown') {|b|
109
- opts[:log_event_verbose] = b
110
+ cmd_opts[:log_event_verbose] = b
110
111
  }
111
112
 
112
113
  op.on('-i', '--inline-config CONFIG_STRING', "inline config which is appended to the config file on-the-fly") {|s|
113
- opts[:inline_config] = s
114
+ cmd_opts[:inline_config] = s
114
115
  }
115
116
 
116
117
  op.on('--emit-error-log-interval SECONDS', "suppress interval seconds of emit error logs") {|s|
117
- opts[:suppress_interval] = s.to_i
118
+ cmd_opts[:suppress_interval] = s.to_i
118
119
  }
119
120
 
120
121
  op.on('--suppress-repeated-stacktrace [VALUE]', "suppress repeated stacktrace", TrueClass) {|b|
121
122
  b = true if b.nil?
122
- opts[:suppress_repeated_stacktrace] = b
123
+ cmd_opts[:suppress_repeated_stacktrace] = b
123
124
  }
124
125
 
125
126
  op.on('--without-source', "invoke a fluentd without input plugins", TrueClass) {|b|
126
- opts[:without_source] = b
127
+ cmd_opts[:without_source] = b
127
128
  }
128
129
 
129
130
  op.on('--config-file-type VALU', 'guessing file type of fluentd configuration. yaml/yml or guess') { |s|
130
131
  if (s == 'yaml') || (s == 'yml')
131
- opts[:config_file_type] = s.to_sym
132
+ cmd_opts[:config_file_type] = s.to_sym
132
133
  elsif (s == 'guess')
133
- opts[:config_file_type] = s.to_sym
134
+ cmd_opts[:config_file_type] = s.to_sym
134
135
  else
135
136
  usage '--config-file-type accepts yaml/yml or guess'
136
137
  end
137
138
  }
138
139
 
139
140
  op.on('--use-v1-config', "Use v1 configuration format (default)", TrueClass) {|b|
140
- opts[:use_v1_config] = b
141
+ cmd_opts[:use_v1_config] = b
141
142
  }
142
143
 
143
144
  op.on('--use-v0-config', "Use v0 configuration format", TrueClass) {|b|
144
- opts[:use_v1_config] = !b
145
+ cmd_opts[:use_v1_config] = !b
145
146
  }
146
147
 
147
148
  op.on('--strict-config-value', "Parse config values strictly", TrueClass) {|b|
148
- opts[:strict_config_value] = b
149
+ cmd_opts[:strict_config_value] = b
149
150
  }
150
151
 
151
152
  op.on('--enable-input-metrics', "Enable input plugin metrics on fluentd", TrueClass) {|b|
152
- opts[:enable_input_metrics] = b
153
+ cmd_opts[:enable_input_metrics] = b
153
154
  }
154
155
 
155
156
  op.on('--enable-size-metrics', "Enable plugin record size metrics on fluentd", TrueClass) {|b|
156
- opts[:enable_size_metrics] = b
157
+ cmd_opts[:enable_size_metrics] = b
157
158
  }
158
159
 
159
160
  op.on('-v', '--verbose', "increase verbose level (-v: debug, -vv: trace)", TrueClass) {|b|
160
- if b
161
- opts[:log_level] = [opts[:log_level] - 1, Fluent::Log::LEVEL_TRACE].max
162
- end
161
+ return unless b
162
+ cur_level = cmd_opts.fetch(:log_level, default_opts[:log_level])
163
+ cmd_opts[:log_level] = [cur_level - 1, Fluent::Log::LEVEL_TRACE].max
163
164
  }
164
165
 
165
166
  op.on('-q', '--quiet', "decrease verbose level (-q: warn, -qq: error)", TrueClass) {|b|
166
- if b
167
- opts[:log_level] = [opts[:log_level] + 1, Fluent::Log::LEVEL_ERROR].min
168
- end
167
+ return unless b
168
+ cur_level = cmd_opts.fetch(:log_level, default_opts[:log_level])
169
+ cmd_opts[:log_level] = [cur_level + 1, Fluent::Log::LEVEL_ERROR].min
169
170
  }
170
171
 
171
172
  op.on('--suppress-config-dump', "suppress config dumping when fluentd starts", TrueClass) {|b|
172
- opts[:suppress_config_dump] = b
173
+ cmd_opts[:suppress_config_dump] = b
173
174
  }
174
175
 
175
176
  op.on('-g', '--gemfile GEMFILE', "Gemfile path") {|s|
176
- opts[:gemfile] = s
177
+ cmd_opts[:gemfile] = s
177
178
  }
178
179
 
179
180
  op.on('-G', '--gem-path GEM_INSTALL_PATH', "Gemfile install path (default: $(dirname $gemfile)/vendor/bundle)") {|s|
180
- opts[:gem_install_path] = s
181
+ cmd_opts[:gem_install_path] = s
181
182
  }
182
183
 
183
184
  op.on('--conf-encoding ENCODING', "specify configuration file encoding") { |s|
184
- opts[:conf_encoding] = s
185
+ cmd_opts[:conf_encoding] = s
185
186
  }
186
187
 
187
188
  op.on('--disable-shared-socket', "Don't open shared socket for multiple workers") { |b|
188
- opts[:disable_shared_socket] = b
189
+ cmd_opts[:disable_shared_socket] = b
189
190
  }
190
191
 
191
192
  if Fluent.windows?
192
- opts.merge!(
193
+ cmd_opts.merge!(
193
194
  :winsvc_name => 'fluentdwinsvc',
194
195
  :winsvc_display_name => 'Fluentd Windows Service',
195
196
  :winsvc_desc => 'Fluentd is an event collector system.',
196
197
  )
197
198
 
198
199
  op.on('-x', '--signame INTSIGNAME', "an object name which is used for Windows Service signal (Windows only)") {|s|
199
- opts[:signame] = s
200
+ cmd_opts[:signame] = s
200
201
  }
201
202
 
202
203
  op.on('--reg-winsvc MODE', "install/uninstall as Windows Service. (i: install, u: uninstall) (Windows only)") {|s|
203
- opts[:regwinsvc] = s
204
+ cmd_opts[:regwinsvc] = s
204
205
  }
205
206
 
206
207
  op.on('--[no-]reg-winsvc-auto-start', "Automatically start the Windows Service at boot. (only effective with '--reg-winsvc i') (Windows only)") {|s|
207
- opts[:regwinsvcautostart] = s
208
+ cmd_opts[:regwinsvcautostart] = s
208
209
  }
209
210
 
210
211
  op.on('--[no-]reg-winsvc-delay-start', "Automatically start the Windows Service at boot with delay. (only effective with '--reg-winsvc i' and '--reg-winsvc-auto-start') (Windows only)") {|s|
211
- opts[:regwinsvcdelaystart] = s
212
+ cmd_opts[:regwinsvcdelaystart] = s
212
213
  }
213
214
 
214
215
  op.on('--reg-winsvc-fluentdopt OPTION', "specify fluentd option parameters for Windows Service. (Windows only)") {|s|
215
- opts[:fluentdopt] = s
216
+ cmd_opts[:fluentdopt] = s
216
217
  }
217
218
 
218
219
  op.on('--winsvc-name NAME', "The Windows Service name to run as (Windows only)") {|s|
219
- opts[:winsvc_name] = s
220
+ cmd_opts[:winsvc_name] = s
220
221
  }
221
222
 
222
223
  op.on('--winsvc-display-name DISPLAY_NAME', "The Windows Service display name (Windows only)") {|s|
223
- opts[:winsvc_display_name] = s
224
+ cmd_opts[:winsvc_display_name] = s
224
225
  }
225
226
 
226
227
  op.on('--winsvc-desc DESC', "The Windows Service description (Windows only)") {|s|
227
- opts[:winsvc_desc] = s
228
+ cmd_opts[:winsvc_desc] = s
228
229
  }
229
230
  end
230
231
 
@@ -247,6 +248,7 @@ rescue
247
248
  usage $!.to_s
248
249
  end
249
250
 
251
+ opts = default_opts.merge(cmd_opts)
250
252
 
251
253
  ##
252
254
  ## Bundler injection
@@ -345,18 +347,7 @@ end
345
347
  exit 0 if early_exit
346
348
 
347
349
  if opts[:supervise]
348
- if Fluent.windows?
349
- if opts[:log_path] && opts[:log_path] != "-"
350
- if opts[:log_rotate_age] || opts[:log_rotate_size]
351
- require 'pathname'
352
-
353
- log_path = Pathname(opts[:log_path]).sub_ext("-supervisor#{Pathname(opts[:log_path]).extname}").to_s
354
- opts[:log_path] = log_path
355
- end
356
- end
357
- end
358
-
359
- supervisor = Fluent::Supervisor.new(opts)
350
+ supervisor = Fluent::Supervisor.new(cmd_opts)
360
351
  supervisor.configure(supervisor: true)
361
352
  supervisor.run_supervisor(dry_run: opts[:dry_run])
362
353
  else
@@ -364,7 +355,7 @@ else
364
355
  puts "Error: multi workers is not supported with --no-supervisor"
365
356
  exit 2
366
357
  end
367
- worker = Fluent::Supervisor.new(opts)
358
+ worker = Fluent::Supervisor.new(cmd_opts)
368
359
  worker.configure
369
360
 
370
361
  if opts[:daemonize] && opts[:standalone_worker]
@@ -44,7 +44,7 @@ module Fluent
44
44
  visitor = Visitor.new(scanner, class_loader)
45
45
 
46
46
  visitor._register_domain(INCLUDE_TAG) do |_, val|
47
- load(path.parent.join(val))
47
+ eval_include(Pathname.new(val), path.parent)
48
48
  end
49
49
 
50
50
  visitor._register_domain(FLUENT_JSON_TAG) do |_, val|
@@ -60,6 +60,23 @@ module Fluent
60
60
  end
61
61
  end
62
62
 
63
+ def eval_include(path, parent)
64
+ if path.relative?
65
+ pattern = parent.join(path)
66
+ else
67
+ pattern = path
68
+ end
69
+ result = []
70
+ Dir.glob(pattern).sort.each do |path|
71
+ result.concat(load(Pathname.new(path)))
72
+ end
73
+ result
74
+ rescue SystemCallError => e
75
+ parse_error = ConfigParseError.new("include error #{path} - #{e}")
76
+ parse_error.set_backtrace(e.backtrace)
77
+ raise parse_error
78
+ end
79
+
63
80
  class Visitor < Psych::Visitors::ToRuby
64
81
  def initialize(scanner, class_loader)
65
82
  super(scanner, class_loader)
data/lib/fluent/daemon.rb CHANGED
@@ -9,7 +9,5 @@ require 'fluent/supervisor'
9
9
 
10
10
  server_module = Fluent.const_get(ARGV[0])
11
11
  worker_module = Fluent.const_get(ARGV[1])
12
- # it doesn't call ARGV in block because when reloading config, params will be initialized and then it can't use previous config.
13
- config_path = ARGV[2]
14
- params = JSON.parse(ARGV[3])
15
- ServerEngine::Daemon.run_server(server_module, worker_module) { Fluent::Supervisor.load_config(config_path, params) }
12
+ params = JSON.parse(ARGV[2])
13
+ ServerEngine::Daemon.run_server(server_module, worker_module) { Fluent::Supervisor.serverengine_config(params) }