fluentd 1.14.5-x86-mingw32 → 1.15.1-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.

Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/config.yml +2 -2
  3. data/.github/workflows/linux-test.yaml +1 -1
  4. data/.github/workflows/macos-test.yaml +5 -1
  5. data/.github/workflows/windows-test.yaml +9 -6
  6. data/CHANGELOG.md +105 -21
  7. data/CONTRIBUTING.md +1 -1
  8. data/MAINTAINERS.md +2 -2
  9. data/README.md +1 -1
  10. data/fluentd.gemspec +2 -1
  11. data/lib/fluent/command/ctl.rb +4 -1
  12. data/lib/fluent/command/fluentd.rb +14 -0
  13. data/lib/fluent/config/literal_parser.rb +2 -2
  14. data/lib/fluent/config/yaml_parser/fluent_value.rb +47 -0
  15. data/lib/fluent/config/yaml_parser/loader.rb +91 -0
  16. data/lib/fluent/config/yaml_parser/parser.rb +166 -0
  17. data/lib/fluent/config/yaml_parser/section_builder.rb +107 -0
  18. data/lib/fluent/config/yaml_parser.rb +56 -0
  19. data/lib/fluent/config.rb +14 -1
  20. data/lib/fluent/error.rb +3 -0
  21. data/lib/fluent/event_router.rb +19 -1
  22. data/lib/fluent/plugin/bare_output.rb +1 -1
  23. data/lib/fluent/plugin/base.rb +19 -0
  24. data/lib/fluent/plugin/file_wrapper.rb +52 -107
  25. data/lib/fluent/plugin/in_forward.rb +1 -1
  26. data/lib/fluent/plugin/in_tail/group_watch.rb +204 -0
  27. data/lib/fluent/plugin/in_tail/position_file.rb +1 -15
  28. data/lib/fluent/plugin/in_tail.rb +68 -48
  29. data/lib/fluent/plugin/out_file.rb +11 -1
  30. data/lib/fluent/plugin/out_forward/socket_cache.rb +2 -0
  31. data/lib/fluent/plugin/output.rb +43 -37
  32. data/lib/fluent/plugin/parser.rb +3 -4
  33. data/lib/fluent/plugin/parser_syslog.rb +1 -1
  34. data/lib/fluent/plugin_helper/retry_state.rb +14 -4
  35. data/lib/fluent/plugin_helper/server.rb +23 -4
  36. data/lib/fluent/plugin_helper/service_discovery.rb +2 -2
  37. data/lib/fluent/rpc.rb +4 -3
  38. data/lib/fluent/supervisor.rb +119 -28
  39. data/lib/fluent/system_config.rb +2 -1
  40. data/lib/fluent/version.rb +1 -1
  41. data/lib/fluent/winsvc.rb +2 -0
  42. data/test/command/test_ctl.rb +0 -1
  43. data/test/command/test_fluentd.rb +33 -0
  44. data/test/config/test_system_config.rb +3 -1
  45. data/test/config/test_types.rb +1 -1
  46. data/test/plugin/in_tail/test_io_handler.rb +14 -4
  47. data/test/plugin/in_tail/test_position_file.rb +0 -63
  48. data/test/plugin/out_forward/test_socket_cache.rb +26 -1
  49. data/test/plugin/test_base.rb +34 -0
  50. data/test/plugin/test_file_wrapper.rb +0 -68
  51. data/test/plugin/test_in_forward.rb +0 -2
  52. data/test/plugin/test_in_object_space.rb +9 -3
  53. data/test/plugin/test_in_syslog.rb +1 -1
  54. data/test/plugin/test_in_tail.rb +629 -353
  55. data/test/plugin/test_out_forward.rb +30 -20
  56. data/test/plugin/test_output_as_buffered_retries.rb +7 -7
  57. data/test/plugin/test_output_as_buffered_secondary.rb +1 -1
  58. data/test/plugin/test_parser_syslog.rb +1 -1
  59. data/test/plugin_helper/test_cert_option.rb +1 -1
  60. data/test/plugin_helper/test_child_process.rb +16 -4
  61. data/test/plugin_helper/test_retry_state.rb +602 -38
  62. data/test/plugin_helper/test_server.rb +18 -0
  63. data/test/test_config.rb +135 -4
  64. data/test/test_event_router.rb +17 -0
  65. data/test/test_supervisor.rb +196 -6
  66. metadata +25 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ab32693bc6090a2f2600b7bd1ac0b34137795a40c9bd9194f15fba1a66ae3f1
4
- data.tar.gz: d3c4c191b81c61c4506dc72d689d0a990bd3f885f37265dc27bd91db52ff8e68
3
+ metadata.gz: 14de5d3497bb33697ce746637f710eb09e7504142a90fcdf80b61dd6de9997ed
4
+ data.tar.gz: 4273c9f6178dc0bb04ac79433c12fc60a0b2ebe5a5876f7fe39b1c4278cae2ad
5
5
  SHA512:
6
- metadata.gz: 43c53a9a990f9cdc33b266f22c4f927200fa6e3c3fbfbec14698c38c68ec998eee6d5441c3993b3de96988bec8035cb56dffbc4008241034f2f403fbf358937a
7
- data.tar.gz: 80b0fbe5ffa8ddb7ace7808318d273a549e3ac56d864f2e650cf8c424cef082c7672d15fbdd7d5cdcd77360d94c92a8d24658ede33e55a150bdb9bf6c432f47d
6
+ metadata.gz: 689134be721ca4af6bf05f278dea10687f24eef985978032be425fdef1a43056f903d04efb8aaf81efc4418ece9127da88e39546643dbb872c962410528dc3f3
7
+ data.tar.gz: bd4ef3aacb731e0f8eeb013b52160e40225f57d15f698fbb8b034e79fbfff2ae3567c76bb5f7d9302b01fff1dca28537886d254a94e5a3af4d913c580636a35d
@@ -1,5 +1,5 @@
1
1
  blank_issues_enabled: false
2
2
  contact_links:
3
3
  - name: Ask a Question
4
- url: https://discuss.fluentd.org/
5
- about: I have questions about Fluentd and plugins. Please ask and answer questions at https://discuss.fluentd.org/.
4
+ url: https://github.com/fluent/fluentd/discussions
5
+ about: I have questions about Fluentd and plugins. Please ask and answer questions at https://github.com/fluent/fluentd/discussions
@@ -13,7 +13,7 @@ jobs:
13
13
  strategy:
14
14
  fail-fast: false
15
15
  matrix:
16
- ruby-version: ['3.0', '2.7', '2.6']
16
+ ruby-version: ['3.1', '3.0', '2.7']
17
17
  os: [ubuntu-latest]
18
18
  experimental: [false]
19
19
  include:
@@ -13,9 +13,13 @@ jobs:
13
13
  strategy:
14
14
  fail-fast: false
15
15
  matrix:
16
- ruby-version: ['head', '2.7']
16
+ ruby-version: ['3.1', '3.0', '2.7']
17
17
  os: [macos-latest]
18
18
  experimental: [true]
19
+ include:
20
+ - ruby-version: head
21
+ os: macos-latest
22
+ experimental: true
19
23
 
20
24
  name: Unit testing with Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}
21
25
  steps:
@@ -13,14 +13,17 @@ jobs:
13
13
  strategy:
14
14
  fail-fast: false
15
15
  matrix:
16
- ruby-version: ['2.7', '2.6']
16
+ ruby-version: ['3.1', '2.7']
17
17
  os:
18
18
  - windows-latest
19
19
  experimental: [false]
20
20
  include:
21
- - ruby-version: '3.0.2'
21
+ - ruby-version: head
22
22
  os: windows-latest
23
23
  experimental: true
24
+ - ruby-version: '3.0.3'
25
+ os: windows-latest
26
+ experimental: false
24
27
  # On Ruby 3.0, we need to use fiddle 1.0.8 or later to retrieve correct
25
28
  # error code. In addition, we have to specify the path of fiddle by RUBYLIB
26
29
  # because RubyInstaller loads Ruby's bundled fiddle before initializing gem.
@@ -28,7 +31,7 @@ jobs:
28
31
  # * https://github.com/ruby/fiddle/issues/72
29
32
  # * https://bugs.ruby-lang.org/issues/17813
30
33
  # * https://github.com/oneclick/rubyinstaller2/blob/8225034c22152d8195bc0aabc42a956c79d6c712/lib/ruby_installer/build/dll_directory.rb
31
- ruby-lib-opt: RUBYLIB=%RUNNER_TOOL_CACHE%/Ruby/3.0.2/x64/lib/ruby/gems/3.0.0/gems/fiddle-1.0.8/lib
34
+ ruby-lib-opt: RUBYLIB=%RUNNER_TOOL_CACHE%/Ruby/3.0.3/x64/lib/ruby/gems/3.0.0/gems/fiddle-1.1.0/lib
32
35
 
33
36
  name: Unit testing with Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}
34
37
  steps:
@@ -37,9 +40,9 @@ jobs:
37
40
  uses: ruby/setup-ruby@v1
38
41
  with:
39
42
  ruby-version: ${{ matrix.ruby-version }}
40
- - name: Add Fiddle 1.0.8
41
- if: ${{ matrix.ruby-version == '3.0.2' }}
42
- run: gem install fiddle --version 1.0.8
43
+ - name: Add Fiddle 1.1.0
44
+ if: ${{ matrix.ruby-version == '3.0.3' }}
45
+ run: gem install fiddle --version 1.1.0
43
46
  - name: Install dependencies
44
47
  run: ridk exec bundle install
45
48
  - name: Run tests
data/CHANGELOG.md CHANGED
@@ -1,4 +1,104 @@
1
- # v1.14.5
1
+ # v1.15
2
+
3
+ ## Release v1.15.1 - 2022/07/27
4
+
5
+ ### Bug Fix
6
+
7
+ * Add support for concurrent append in out_file
8
+ https://github.com/fluent/fluentd/pull/3808
9
+
10
+ ### Misc
11
+
12
+ * in_tail: Show more information on skipping update_watcher
13
+ https://github.com/fluent/fluentd/pull/3829
14
+
15
+ ## Release v1.15.0 - 2022/06/29
16
+
17
+ ### Enhancement
18
+
19
+ * in_tail: Add log throttling in files based on group rules
20
+ https://github.com/fluent/fluentd/pull/3535
21
+ https://github.com/fluent/fluentd/pull/3771
22
+ * Add `dump` command to fluent-ctl
23
+ https://github.com/fluent/fluentd/pull/3680
24
+ * Handle YAML configuration format on configuration file
25
+ https://github.com/fluent/fluentd/pull/3712
26
+ * Add `restart_worker_interval` parameter in `<system>` directive to set
27
+ interval to restart workers that has stopped for some reason.
28
+ https://github.com/fluent/fluentd/pull/3768
29
+
30
+ ### Bug fixes
31
+
32
+ * out_forward: Fix to update timeout of cached sockets
33
+ https://github.com/fluent/fluentd/pull/3711
34
+ * in_tail: Fix a possible crash on file rotation when `follow_inodes true`
35
+ https://github.com/fluent/fluentd/pull/3754
36
+ * output: Fix a possible crash of flush thread
37
+ https://github.com/fluent/fluentd/pull/3755
38
+ * in_tail: Fix crash bugs on Ruby 3.1 on Windows
39
+ https://github.com/fluent/fluentd/pull/3766
40
+ * in_tail: Fix a bug that in_tail cannot open non-ascii path on Windows
41
+ https://github.com/fluent/fluentd/pull/3774
42
+ * Fix a bug that fluentd doesn't release its own log file even after rotated by
43
+ external tools
44
+ https://github.com/fluent/fluentd/pull/3782
45
+
46
+ ### Misc
47
+
48
+ * in_tail: Simplify TargetInfo related code
49
+ https://github.com/fluent/fluentd/pull/3489
50
+ * Fix a wrong issue number in CHANGELOG
51
+ https://github.com/fluent/fluentd/pull/3700
52
+ * server helper: Add comments to linger_timeout behavior about Windows
53
+ https://github.com/fluent/fluentd/pull/3701
54
+ * service_discovery: Fix typo
55
+ https://github.com/fluent/fluentd/pull/3724
56
+ * test: Fix unstable tests and warnings
57
+ https://github.com/fluent/fluentd/pull/3745
58
+ https://github.com/fluent/fluentd/pull/3753
59
+ https://github.com/fluent/fluentd/pull/3767
60
+ https://github.com/fluent/fluentd/pull/3783
61
+ https://github.com/fluent/fluentd/pull/3784
62
+ https://github.com/fluent/fluentd/pull/3785
63
+ https://github.com/fluent/fluentd/pull/3787
64
+
65
+ # v1.14
66
+
67
+ ## Release v1.14.6 - 2022/03/31
68
+
69
+ ### Enhancement
70
+
71
+ * Enable server plugins to specify socket-option `SO_LINGER`
72
+ https://github.com/fluent/fluentd/pull/3644
73
+ * Add `--umask` command line parameter
74
+ https://github.com/fluent/fluentd/pull/3671
75
+ https://github.com/fluent/fluentd/pull/3679
76
+
77
+ ### Bug fixes
78
+
79
+ * Fix metric name typo
80
+ https://github.com/fluent/fluentd/pull/3630
81
+ https://github.com/fluent/fluentd/pull/3673
82
+ * Apply modifications in pipeline to the records being passed to `@ERROR` label
83
+ https://github.com/fluent/fluentd/pull/3631
84
+ * Fix wrong calculation of retry interval
85
+ https://github.com/fluent/fluentd/pull/3640
86
+ https://github.com/fluent/fluentd/pull/3649
87
+ https://github.com/fluent/fluentd/pull/3685
88
+ https://github.com/fluent/fluentd/pull/3686
89
+ * Support IPv6 address for `rpc_endpoint` in `system` config
90
+ https://github.com/fluent/fluentd/pull/3641
91
+
92
+ ### Misc
93
+
94
+ * CI: Support Ruby 3.1 except Windows
95
+ https://github.com/fluent/fluentd/pull/3619
96
+ * Switch to GitHub Discussions
97
+ https://github.com/fluent/fluentd/pull/3654
98
+ * Fix CHANGELOG.md heading styles
99
+ https://github.com/fluent/fluentd/pull/3648
100
+ * Declare `null_value_pattern` as `regexp`
101
+ https://github.com/fluent/fluentd/pull/3650
2
102
 
3
103
  ## Release v1.14.5 - 2022/02/09
4
104
 
@@ -22,8 +122,6 @@
22
122
  * Fix "ArgumentError: unknown keyword: :logger" on Windows with Ruby 3.1
23
123
  https://github.com/fluent/fluentd/pull/3592
24
124
 
25
- # v1.14.4
26
-
27
125
  ## Release v1.14.4 - 2022/01/06
28
126
 
29
127
  ### Enhancement
@@ -41,8 +139,6 @@
41
139
  https://github.com/fluent/fluentd/pull/3574
42
140
  https://github.com/fluent/fluentd/pull/3577
43
141
 
44
- # v1.14.3
45
-
46
142
  ## Release v1.14.3 - 2021/11/26
47
143
 
48
144
  ### Enhancement
@@ -71,8 +167,6 @@
71
167
  newer version is required to implement additional `fluent-ctl` commands.
72
168
  https://github.com/fluent/fluentd/pull/3556
73
169
 
74
- # v1.14.2
75
-
76
170
  ## Release v1.14.2 - 2021/10/29
77
171
 
78
172
  IMPORTANT: This release contain the fix for CVE-2021-41186 -
@@ -84,6 +178,7 @@ We recommend to upgrade Fluentd to v1.14.2 or use patched version of
84
178
  ### Enhancement
85
179
 
86
180
  * fluent-cat: Add `--event-time` option to send specified event time for testing.
181
+ https://github.com/fluent/fluentd/pull/3528
87
182
 
88
183
  ### Bug fix
89
184
 
@@ -92,8 +187,6 @@ We recommend to upgrade Fluentd to v1.14.2 or use patched version of
92
187
  * Fixed ReDoS vulnerability in parser_apache2.
93
188
  This vulnerability is caused by a certain pattern of a broken apache log.
94
189
 
95
- # v1.14.1
96
-
97
190
  ## Release v1.14.1 - 2021/09/29
98
191
 
99
192
  ### Enhancement
@@ -123,8 +216,6 @@ We recommend to upgrade Fluentd to v1.14.2 or use patched version of
123
216
  next_retry_seconds -> next_retry_time)
124
217
  https://github.com/fluent/fluentd/pull/3518
125
218
 
126
- # v1.14.0
127
-
128
219
  ## Release v1.14.0 - 2021/08/30
129
220
 
130
221
  ### Enhancement
@@ -167,7 +258,7 @@ We recommend to upgrade Fluentd to v1.14.2 or use patched version of
167
258
  https://github.com/fluent/fluentd/pull/3479
168
259
  https://github.com/fluent/fluentd/pull/3484
169
260
 
170
- # v1.13.3
261
+ # v1.13
171
262
 
172
263
  ## Release v1.13.3 - 2021/07/27
173
264
 
@@ -189,10 +280,6 @@ We recommend to upgrade Fluentd to v1.14.2 or use patched version of
189
280
  * Remove needless spaces in a sample config file
190
281
  https://github.com/fluent/fluentd/pull/3456
191
282
 
192
- ### Enhancement
193
-
194
- # v1.13.2
195
-
196
283
  ## Release v1.13.2 - 2021/07/12
197
284
 
198
285
  ### Enhancement
@@ -228,8 +315,6 @@ We recommend to upgrade Fluentd to v1.14.2 or use patched version of
228
315
  by security scanning tools.
229
316
  https://github.com/fluent/fluentd/pull/3450
230
317
 
231
- # v1.13.1
232
-
233
318
  ## Release v1.13.1 - 2021/06/25
234
319
 
235
320
  ### Bug fix
@@ -254,8 +339,6 @@ We recommend to upgrade Fluentd to v1.14.2 or use patched version of
254
339
  * CI: Dropped to run CI for Ruby 2.5
255
340
  https://github.com/fluent/fluentd/pull/3412
256
341
 
257
- # v1.13
258
-
259
342
  ## Release v1.13.0 - 2021/05/29
260
343
 
261
344
  ### Enhancement
@@ -303,6 +386,7 @@ We recommend to upgrade Fluentd to v1.14.2 or use patched version of
303
386
  ### Bug fix
304
387
 
305
388
  * in_tail: Fix a bug that refresh_watcher fails to handle file rotations
389
+ https://github.com/fluent/fluentd/pull/3393
306
390
 
307
391
  ## Release v1.12.3 - 2021/04/23
308
392
 
@@ -423,7 +507,7 @@ We recommend to upgrade Fluentd to v1.14.2 or use patched version of
423
507
  ### New feature
424
508
 
425
509
  * in_tail: Add `follow_inode` to support log rotation with wild card
426
- https://github.com/fluent/fluentd/pull/2992
510
+ https://github.com/fluent/fluentd/pull/3182
427
511
  * in_tail: Handle linux capability
428
512
  https://github.com/fluent/fluentd/pull/3155
429
513
  https://github.com/fluent/fluentd/pull/3162
data/CONTRIBUTING.md CHANGED
@@ -6,7 +6,7 @@ We'd love your contribution. Here are the guidelines!
6
6
 
7
7
  RESOURCES of [Official site](https://www.fluentd.org/) and [Fluentd documentation](https://docs.fluentd.org/) may help you.
8
8
 
9
- If you have further questions about Fluentd and plugins, please direct these to [Community Forum](https://discuss.fluentd.org/).
9
+ If you have further questions about Fluentd and plugins, please direct these to [Community Forum](https://github.com/fluent/fluentd/discussions).
10
10
  Don't use Github issue for asking questions. Here are examples:
11
11
 
12
12
  - I installed xxx plugin but it doesn't work. Why?
data/MAINTAINERS.md CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  - [Naotoshi Seo](https://github.com/sonots), [ZOZO Technologies](https://tech.zozo.com/en/)
4
4
  - [Okkez](https://github.com/okkez)
5
- - [Hiroshi Hatake](https://github.com/cosmo0920), [Calyptia](https://www.calyptia.com/)
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
- - [Eduardo Silva](https://github.com/edsiper), [Arm Treasure Data](https://www.treasuredata.com/)
8
+ - [Eduardo Silva](https://github.com/edsiper), [Calyptia](https://calyptia/)
9
9
  - [Fujimoto Seiji](https://github.com/fujimots), [ClearCode](https://www.clear-code.com/)
10
10
  - [Takuro Ashie](https://github.com/ashie), [ClearCode](https://www.clear-code.com/)
11
11
  - [Kentaro Hayashi](https://github.com/kenhys), [ClearCode](https://www.clear-code.com/)
data/README.md CHANGED
@@ -56,7 +56,7 @@ You can run specified test via `TEST` environment variable:
56
56
  - Website: https://www.fluentd.org/
57
57
  - Documentation: https://docs.fluentd.org/
58
58
  - Project repository: https://github.com/fluent
59
- - Discussion: https://discuss.fluentd.org/
59
+ - Discussion: https://github.com/fluent/fluentd/discussions
60
60
  - Slack / Community: https://slack.fluentd.org
61
61
  - Newsletters: https://www.fluentd.org/newsletter
62
62
  - Author: [Sadayuki Furuhashi](https://github.com/frsyuki)
data/fluentd.gemspec CHANGED
@@ -22,7 +22,7 @@ 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.2.5", "< 3.0.0"])
25
+ gem.add_runtime_dependency("serverengine", [">= 2.3.0", "< 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"])
@@ -38,6 +38,7 @@ Gem::Specification.new do |gem|
38
38
  gem.add_runtime_dependency("win32-service", ["~> 2.3.0"])
39
39
  gem.add_runtime_dependency("win32-ipc", ["~> 0.7.0"])
40
40
  gem.add_runtime_dependency("win32-event", ["~> 0.6.3"])
41
+ gem.add_runtime_dependency("windows-api", ["~> 0.4.5"])
41
42
  gem.add_runtime_dependency("windows-pr", ["~> 1.2.6"])
42
43
  gem.add_runtime_dependency("certstore_c", ["~> 0.1.7"])
43
44
  end
@@ -36,6 +36,7 @@ module Fluent
36
36
  restart: "HUP",
37
37
  flush: "USR1",
38
38
  reload: "USR2",
39
+ dump: "CONT",
39
40
  }
40
41
  WINSVC_CONTROL_CODE_MAP = {
41
42
  shutdown: SERVICE_CONTROL_STOP,
@@ -44,6 +45,7 @@ module Fluent
44
45
  restart: 128,
45
46
  flush: 129,
46
47
  reload: SERVICE_CONTROL_PARAMCHANGE,
48
+ dump: 130,
47
49
  }
48
50
  else
49
51
  COMMAND_MAP = {
@@ -51,6 +53,7 @@ module Fluent
51
53
  restart: :HUP,
52
54
  flush: :USR1,
53
55
  reload: :USR2,
56
+ dump: :CONT,
54
57
  }
55
58
  end
56
59
 
@@ -146,7 +149,7 @@ module Fluent
146
149
  event = Win32::Event.open("#{prefix}#{suffix}")
147
150
  event.set
148
151
  event.close
149
- rescue Errno::ENOENT => e
152
+ rescue Errno::ENOENT
150
153
  puts "Error: Cannot find the fluentd process with the event name: \"#{prefix}\""
151
154
  end
152
155
  end
@@ -81,6 +81,10 @@ op.on('--group GROUP', "change group") {|s|
81
81
  opts[:chgroup] = s
82
82
  }
83
83
 
84
+ op.on('--umask UMASK', "change umask") {|s|
85
+ opts[:chumask] = s
86
+ }
87
+
84
88
  op.on('-o', '--log PATH', "log file path") {|s|
85
89
  opts[:log_path] = s
86
90
  }
@@ -122,6 +126,16 @@ op.on('--without-source', "invoke a fluentd without input plugins", TrueClass) {
122
126
  opts[:without_source] = b
123
127
  }
124
128
 
129
+ op.on('--config-file-type VALU', 'guessing file type of fluentd configuration. yaml/yml or guess') { |s|
130
+ if (s == 'yaml') || (s == 'yml')
131
+ opts[:config_file_type] = s.to_sym
132
+ elsif (s == 'guess')
133
+ opts[:config_file_type] = s.to_sym
134
+ else
135
+ usage '--config-file-type accepts yaml/yml or guess'
136
+ end
137
+ }
138
+
125
139
  op.on('--use-v1-config', "Use v1 configuration format (default)", TrueClass) {|b|
126
140
  opts[:use_v1_config] = b
127
141
  }
@@ -191,9 +191,9 @@ worker_id = ENV['SERVERENGINE_WORKER_ID'] || ''
191
191
  EOM
192
192
  begin
193
193
  @eval_context.instance_eval(code)
194
- rescue SetNil => e
194
+ rescue SetNil
195
195
  nil
196
- rescue SetDefault => e
196
+ rescue SetDefault
197
197
  :default
198
198
  end
199
199
  end
@@ -0,0 +1,47 @@
1
+ #
2
+ # Fluentd
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ module Fluent
18
+ module Config
19
+ module YamlParser
20
+ module FluentValue
21
+ JsonValue = Struct.new(:val) do
22
+ def to_s
23
+ val.to_json
24
+ end
25
+
26
+ def to_element
27
+ to_s
28
+ end
29
+ end
30
+
31
+ StringValue = Struct.new(:val, :context) do
32
+ def to_s
33
+ context.instance_eval("\"#{val}\"")
34
+ rescue Fluent::SetNil => _
35
+ ''
36
+ rescue Fluent::SetDefault => _
37
+ ':default'
38
+ end
39
+
40
+ def to_element
41
+ to_s
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,91 @@
1
+ #
2
+ # Fluentd
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'psych'
18
+ require 'json'
19
+ require 'fluent/config/error'
20
+ require 'fluent/config/yaml_parser/fluent_value'
21
+
22
+ # Based on https://github.com/eagletmt/hako/blob/34cdde06fe8f3aeafd794be830180c3cedfbb4dc/lib/hako/yaml_loader.rb
23
+
24
+ module Fluent
25
+ module Config
26
+ module YamlParser
27
+ class Loader
28
+ INCLUDE_TAG = 'tag:include'.freeze
29
+ FLUENT_JSON_TAG = 'tag:fluent/json'.freeze
30
+ FLUENT_STR_TAG = 'tag:fluent/s'.freeze
31
+ SHOVEL = '<<'.freeze
32
+
33
+ def initialize(context = Kernel.binding)
34
+ @context = context
35
+ @current_path = nil
36
+ end
37
+
38
+ # @param [String] path
39
+ # @return [Hash]
40
+ def load(path)
41
+ class_loader = Psych::ClassLoader.new
42
+ scanner = Psych::ScalarScanner.new(class_loader)
43
+
44
+ visitor = Visitor.new(scanner, class_loader)
45
+
46
+ visitor._register_domain(INCLUDE_TAG) do |_, val|
47
+ load(path.parent.join(val))
48
+ end
49
+
50
+ visitor._register_domain(FLUENT_JSON_TAG) do |_, val|
51
+ Fluent::Config::YamlParser::FluentValue::JsonValue.new(val)
52
+ end
53
+
54
+ visitor._register_domain(FLUENT_STR_TAG) do |_, val|
55
+ Fluent::Config::YamlParser::FluentValue::StringValue.new(val, @context)
56
+ end
57
+
58
+ path.open do |f|
59
+ visitor.accept(Psych.parse(f))
60
+ end
61
+ end
62
+
63
+ class Visitor < Psych::Visitors::ToRuby
64
+ def initialize(scanner, class_loader)
65
+ super(scanner, class_loader)
66
+ end
67
+
68
+ def _register_domain(name, &block)
69
+ @domain_types.merge!({ name => [name, block] })
70
+ end
71
+
72
+ def revive_hash(hash, o)
73
+ super(hash, o).tap do |r|
74
+ if r[SHOVEL].is_a?(Hash)
75
+ h2 = {}
76
+ r.each do |k, v|
77
+ if k == SHOVEL
78
+ h2.merge!(v)
79
+ else
80
+ h2[k] = v
81
+ end
82
+ end
83
+ r.replace(h2)
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end