fluentd 1.16.0 → 1.16.7

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 (90) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/{bug_report.yaml → bug_report.yml} +1 -0
  3. data/.github/ISSUE_TEMPLATE/{feature_request.yaml → feature_request.yml} +1 -0
  4. data/.github/workflows/stale-actions.yml +24 -0
  5. data/.github/workflows/test.yml +39 -0
  6. data/CHANGELOG.md +161 -0
  7. data/CONTRIBUTING.md +1 -1
  8. data/MAINTAINERS.md +3 -3
  9. data/README.md +0 -2
  10. data/SECURITY.md +5 -9
  11. data/fluentd.gemspec +10 -2
  12. data/lib/fluent/command/ctl.rb +2 -2
  13. data/lib/fluent/command/fluentd.rb +1 -1
  14. data/lib/fluent/command/plugin_config_formatter.rb +1 -1
  15. data/lib/fluent/config/dsl.rb +1 -1
  16. data/lib/fluent/config/v1_parser.rb +2 -2
  17. data/lib/fluent/config/yaml_parser/parser.rb +4 -0
  18. data/lib/fluent/counter/server.rb +1 -1
  19. data/lib/fluent/counter/validator.rb +3 -3
  20. data/lib/fluent/engine.rb +1 -1
  21. data/lib/fluent/event.rb +8 -4
  22. data/lib/fluent/log.rb +9 -0
  23. data/lib/fluent/match.rb +1 -1
  24. data/lib/fluent/msgpack_factory.rb +6 -1
  25. data/lib/fluent/plugin/base.rb +1 -1
  26. data/lib/fluent/plugin/buffer.rb +96 -87
  27. data/lib/fluent/plugin/filter_record_transformer.rb +1 -1
  28. data/lib/fluent/plugin/in_forward.rb +1 -1
  29. data/lib/fluent/plugin/in_http.rb +8 -8
  30. data/lib/fluent/plugin/in_sample.rb +1 -1
  31. data/lib/fluent/plugin/in_tail/position_file.rb +32 -18
  32. data/lib/fluent/plugin/in_tail.rb +99 -31
  33. data/lib/fluent/plugin/in_tcp.rb +43 -0
  34. data/lib/fluent/plugin/out_exec_filter.rb +2 -2
  35. data/lib/fluent/plugin/out_file.rb +8 -0
  36. data/lib/fluent/plugin/output.rb +2 -2
  37. data/lib/fluent/plugin/parser_json.rb +4 -12
  38. data/lib/fluent/plugin_helper/event_loop.rb +2 -2
  39. data/lib/fluent/plugin_helper/record_accessor.rb +1 -1
  40. data/lib/fluent/plugin_helper/server.rb +8 -0
  41. data/lib/fluent/plugin_helper/thread.rb +3 -3
  42. data/lib/fluent/plugin_id.rb +1 -1
  43. data/lib/fluent/supervisor.rb +2 -2
  44. data/lib/fluent/system_config.rb +1 -1
  45. data/lib/fluent/version.rb +1 -1
  46. data/lib/fluent/winsvc.rb +28 -3
  47. data/templates/new_gem/test/helper.rb.erb +0 -1
  48. data/test/command/test_cat.rb +2 -2
  49. data/test/command/test_fluentd.rb +65 -12
  50. data/test/config/test_system_config.rb +2 -2
  51. data/test/helper.rb +27 -7
  52. data/test/plugin/in_tail/test_io_handler.rb +13 -14
  53. data/test/plugin/in_tail/test_position_file.rb +37 -8
  54. data/test/plugin/out_forward/test_ack_handler.rb +3 -3
  55. data/test/plugin/out_forward/test_socket_cache.rb +3 -3
  56. data/test/plugin/test_base.rb +1 -1
  57. data/test/plugin/test_buffer.rb +110 -0
  58. data/test/plugin/test_buffer_chunk.rb +11 -0
  59. data/test/plugin/test_in_forward.rb +11 -10
  60. data/test/plugin/test_in_http.rb +1 -1
  61. data/test/plugin/test_in_monitor_agent.rb +6 -6
  62. data/test/plugin/test_in_syslog.rb +25 -18
  63. data/test/plugin/test_in_tail.rb +639 -0
  64. data/test/plugin/test_in_tcp.rb +75 -5
  65. data/test/plugin/test_in_udp.rb +35 -1
  66. data/test/plugin/test_in_unix.rb +2 -2
  67. data/test/plugin/test_multi_output.rb +1 -1
  68. data/test/plugin/test_out_exec_filter.rb +14 -9
  69. data/test/plugin/test_out_file.rb +24 -4
  70. data/test/plugin/test_out_forward.rb +36 -42
  71. data/test/plugin/test_out_stream.rb +1 -1
  72. data/test/plugin/test_output.rb +12 -12
  73. data/test/plugin/test_output_as_buffered.rb +44 -44
  74. data/test/plugin/test_output_as_buffered_compress.rb +32 -18
  75. data/test/plugin/test_output_as_buffered_retries.rb +1 -1
  76. data/test/plugin/test_output_as_buffered_secondary.rb +2 -2
  77. data/test/plugin/test_parser_json.rb +31 -0
  78. data/test/plugin_helper/test_child_process.rb +15 -5
  79. data/test/plugin_helper/test_http_server_helper.rb +1 -1
  80. data/test/plugin_helper/test_server.rb +110 -38
  81. data/test/plugin_helper/test_socket.rb +1 -1
  82. data/test/test_config.rb +6 -0
  83. data/test/test_event_router.rb +2 -2
  84. data/test/test_log.rb +38 -1
  85. data/test/test_msgpack_factory.rb +32 -0
  86. data/test/test_supervisor.rb +13 -0
  87. metadata +44 -17
  88. data/.github/workflows/linux-test.yaml +0 -36
  89. data/.github/workflows/macos-test.yaml +0 -34
  90. data/.github/workflows/windows-test.yaml +0 -49
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6fc34e74bc59490b0c8a3416ce9028aa92883d875a9d0f20ac4cddfc95bb40d0
4
- data.tar.gz: 4cdd96916326fceed441e564b82c7024143ee6f179c37d1eb0a3b3746d2d9850
3
+ metadata.gz: c0f930ec85d04a2058c7bf4bb51b1aec63a3cd99bfd00c5ac45ee8271dce8d57
4
+ data.tar.gz: 89f8a6c05c0b8088bef58c354044662ac1c48ddca7ba12600898612d49460ef9
5
5
  SHA512:
6
- metadata.gz: 219d732710b6a7d9f385b4a6a8c254b00f2c6eb98f96fea27e0d1d5947056fa67213a8f5fd5b08361adb92fa7fe2d00e20e4a3bb410523de2538b1a1572214ea
7
- data.tar.gz: 4350fa09941c69bff107d383fd6c5b4a084f579843b2d65bd979da612418e0e9bc2185dd6dca96e0d77cc03a1d3b79bf0e9856d9f4abc9d7336af4b50b95a41b
6
+ metadata.gz: 739775f981a042b9947ed2827c74ac75b204eca93a8d050b0fb73aa02d4a2ba7a84939e6d5d31416944e68fd74b29a7cef7c632886e8826596361adf8d83f4f1
7
+ data.tar.gz: e85f9a8bb9d2b60b145539a453f9d72d382f9e72332eeb20c226f40b948680040cfeadd5b6308c9a40419f2442573e2fcc782a2b09f30259a3e48add3939185e
@@ -1,5 +1,6 @@
1
1
  name: Bug Report
2
2
  description: Create a report with a procedure for reproducing the bug
3
+ labels: "waiting-for-triage"
3
4
  body:
4
5
  - type: markdown
5
6
  attributes:
@@ -1,5 +1,6 @@
1
1
  name: Feature request
2
2
  description: Suggest an idea for this project
3
+ labels: "waiting-for-triage"
3
4
  body:
4
5
  - type: markdown
5
6
  attributes:
@@ -0,0 +1,24 @@
1
+ name: "Mark or close stale issues and PRs"
2
+ on:
3
+ schedule:
4
+ - cron: "00 10 * * *"
5
+
6
+ jobs:
7
+ stale:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/stale@v8
11
+ with:
12
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
13
+ days-before-stale: 30
14
+ days-before-close: 7
15
+ stale-issue-message: "This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 7 days"
16
+ stale-pr-message: "This PR has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this PR will be closed in 7 days"
17
+ close-issue-message: "This issue was automatically closed because of stale in 7 days"
18
+ close-pr-message: "This PR was automatically closed because of stale in 7 days"
19
+ stale-pr-label: "stale"
20
+ stale-issue-label: "stale"
21
+ exempt-issue-labels: "waiting-for-triage,bug,enhancement,feature request,pending,work_in_progress,v1,v2"
22
+ exempt-pr-labels: "waiting-for-triage,bug,enhancement,feature request,pending,work_in_progress,v1,v2"
23
+ exempt-all-assignees: true
24
+ exempt-all-milestones: true
@@ -0,0 +1,39 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches: [v1.16]
6
+ paths-ignore:
7
+ - '*.md'
8
+ - 'lib/fluent/version.rb'
9
+ pull_request:
10
+ branches: [v1.16]
11
+ paths-ignore:
12
+ - '*.md'
13
+ - 'lib/fluent/version.rb'
14
+
15
+ jobs:
16
+ test:
17
+ runs-on: ${{ matrix.os }}
18
+ continue-on-error: false
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
23
+ ruby-version: ['3.3', '3.2', '3.1', '3.0', '2.7']
24
+
25
+ name: Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}
26
+ steps:
27
+ - uses: actions/checkout@v3
28
+ - name: Set up Ruby
29
+ uses: ruby/setup-ruby@v1
30
+ with:
31
+ ruby-version: ${{ matrix.ruby-version }}
32
+ rubygems: latest
33
+ - name: Install addons
34
+ if: ${{ matrix.os == 'ubuntu-latest' }}
35
+ run: sudo apt-get install libgmp3-dev libcap-ng-dev
36
+ - name: Install dependencies
37
+ run: bundle install
38
+ - name: Run tests
39
+ run: bundle exec rake test TESTOPTS="-v --no-show-detail-immediately"
data/CHANGELOG.md CHANGED
@@ -1,5 +1,166 @@
1
1
  # v1.16
2
2
 
3
+ ## Release v1.16.7 - 2025/01/29
4
+
5
+ ### Bug Fix
6
+
7
+ * Windows: Fix `NoMethodError` of `--daemon` option
8
+ https://github.com/fluent/fluentd/pull/4796
9
+ * Windows: Fixed an issue where stopping the service immediately after startup could leave the processes
10
+ https://github.com/fluent/fluentd/pull/4782
11
+ * Windows: Fixed an issue where stopping service sometimes can not be completed forever
12
+ https://github.com/fluent/fluentd/pull/4782
13
+
14
+ ### Misc
15
+
16
+ * Windows: Add workaround for unexpected exception
17
+ https://github.com/fluent/fluentd/pull/4747
18
+ * README: remove deprecated google analytics beacon
19
+ https://github.com/fluent/fluentd/pull/4797
20
+ * CI improvemnts
21
+ https://github.com/fluent/fluentd/pull/4723
22
+ https://github.com/fluent/fluentd/pull/4788
23
+ https://github.com/fluent/fluentd/pull/4789
24
+ https://github.com/fluent/fluentd/pull/4790
25
+ https://github.com/fluent/fluentd/pull/4791
26
+ https://github.com/fluent/fluentd/pull/4793
27
+ https://github.com/fluent/fluentd/pull/4794
28
+ https://github.com/fluent/fluentd/pull/4795
29
+ https://github.com/fluent/fluentd/pull/4798
30
+ https://github.com/fluent/fluentd/pull/4799
31
+ https://github.com/fluent/fluentd/pull/4800
32
+ https://github.com/fluent/fluentd/pull/4801
33
+ https://github.com/fluent/fluentd/pull/4803
34
+
35
+ ## Release v1.16.6 - 2024/08/16
36
+
37
+ ### Bug Fix
38
+
39
+ * YAML config syntax: Fix issue where `$log_level` element was not supported correctly
40
+ https://github.com/fluent/fluentd/pull/4486
41
+ * parser_json: Fix wrong LoadError warning
42
+ https://github.com/fluent/fluentd/pull/4592
43
+ * `fluentd` command: Fix `--plugin` (`-p`) option not to overwrite default value
44
+ https://github.com/fluent/fluentd/pull/4605
45
+
46
+ ### Misc
47
+
48
+ * out_file: Add warn message for symlink_path setting
49
+ https://github.com/fluent/fluentd/pull/4512
50
+ * Keep console gem v1.23 to avoid LoadError
51
+ https://github.com/fluent/fluentd/pull/4510
52
+
53
+ ## Release v1.16.5 - 2024/03/27
54
+
55
+ ### Bug Fix
56
+
57
+ * Buffer: Fix emit error of v1.16.4 sometimes failing to process large data
58
+ exceeding chunk size limit
59
+ https://github.com/fluent/fluentd/pull/4447
60
+
61
+ ## Release v1.16.4 - 2024/03/14
62
+
63
+ ### Bug Fix
64
+
65
+ * Fix to avoid processing discarded chunks in write_step_by_step.
66
+ It fixes not to raise pile of IOError when many `chunk
67
+ bytes limit exceeds` errors are occurred.
68
+ https://github.com/fluent/fluentd/pull/4342
69
+ * in_tail: Fix tail watchers in `rotate_wait` state not being managed.
70
+ https://github.com/fluent/fluentd/pull/4334
71
+
72
+ ### Misc
73
+
74
+ * buffer: Avoid unnecessary log processing. It will improve performance.
75
+ https://github.com/fluent/fluentd/pull/4331
76
+
77
+ ## Release v1.16.3 - 2023/11/14
78
+
79
+ ### Bug Fix
80
+
81
+ * in_tail: Fix a stall bug on !follow_inode case
82
+ https://github.com/fluent/fluentd/pull/4327
83
+ * in_tail: add warning for silent stop on !follow_inodes case
84
+ https://github.com/fluent/fluentd/pull/4339
85
+ * Buffer: Fix NoMethodError with empty unstaged chunk arrays
86
+ https://github.com/fluent/fluentd/pull/4303
87
+ * Fix for rotate_age where Fluentd passes as Symbol
88
+ https://github.com/fluent/fluentd/pull/4311
89
+
90
+ ## Release v1.16.2 - 2023/07/14
91
+
92
+ ### Bug Fix
93
+
94
+ * in_tail: Fix new watcher is wrongly detached on rotation when `follow_inodes`,
95
+ which causes stopping tailing the file
96
+ https://github.com/fluent/fluentd/pull/4208
97
+ * in_tail: Prevent wrongly unwatching when `follow_inodes`, which causes log
98
+ duplication
99
+ https://github.com/fluent/fluentd/pull/4237
100
+ * in_tail: Fix warning log about overwriting entry when `follow_inodes`
101
+ https://github.com/fluent/fluentd/pull/4214
102
+ * in_tail: Ensure to discard TailWatcher with missing target when `follow_inodes`
103
+ https://github.com/fluent/fluentd/pull/4239
104
+ * MessagePackFactory: Make sure to reset local unpacker to prevent received
105
+ broken data from affecting other receiving data
106
+ https://github.com/fluent/fluentd/pull/4178
107
+ * Fix failure to launch Fluentd on Windows when the log path isn't specified in
108
+ the command line
109
+ https://github.com/fluent/fluentd/pull/4188
110
+ * logger: Prevent growing cache size of `ignore_same_log_interval` unlimitedly
111
+ https://github.com/fluent/fluentd/pull/4229
112
+ * Update sigdump to 0.2.5 to fix wrong value of object counts
113
+ https://github.com/fluent/fluentd/pull/4225
114
+
115
+ ### Misc
116
+
117
+ * in_tail: Check detaching inode when `follow_inodes`
118
+ https://github.com/fluent/fluentd/pull/4191
119
+ * in_tail: Add debug log for pos file compaction
120
+ https://github.com/fluent/fluentd/pull/4228
121
+ * Code improvements detected by RuboCop Performance
122
+ https://github.com/fluent/fluentd/pull/4201
123
+ https://github.com/fluent/fluentd/pull/4210
124
+ * Add notice for unused argument `unpacker` of `ChunkMessagePackEventStreamer.each`
125
+ https://github.com/fluent/fluentd/pull/4159
126
+
127
+ ## Release v1.16.1 - 2023/04/17
128
+
129
+ ### Enhancement
130
+
131
+ * in_tcp: Add `message_length_limit` to drop large incoming data
132
+ https://github.com/fluent/fluentd/pull/4137
133
+
134
+ ### Bug Fix
135
+
136
+ * Fix NameError of `SecondaryFileOutput` when setting secondary other than
137
+ `out_secondary_file`
138
+ https://github.com/fluent/fluentd/pull/4124
139
+ * Server helper: Suppress error of `UDPServer` over `max_bytes` on Windows
140
+ https://github.com/fluent/fluentd/pull/4131
141
+ * Buffer: Fix that `compress` setting causes unexpected error when receiving
142
+ already compressed MessagePack
143
+ https://github.com/fluent/fluentd/pull/4147
144
+
145
+ ### Misc
146
+
147
+ * Update MAINTAINERS.md
148
+ https://github.com/fluent/fluentd/pull/4119
149
+ * Update security policy
150
+ https://github.com/fluent/fluentd/pull/4123
151
+ * Plugin template: Remove unnecessary code
152
+ https://github.com/fluent/fluentd/pull/4128
153
+ * Revive issue auto closer
154
+ https://github.com/fluent/fluentd/pull/4116
155
+ * Fix a link for the repository of td-agent
156
+ https://github.com/fluent/fluentd/pull/4145
157
+ * in_udp: add test of message_length_limit
158
+ https://github.com/fluent/fluentd/pull/4117
159
+ * Fix a typo of an argument of `Fluent::EventStream#each`
160
+ https://github.com/fluent/fluentd/pull/4148
161
+ * Test in_tcp: Fix undesirable way to assert logs
162
+ https://github.com/fluent/fluentd/pull/4138
163
+
3
164
  ## Release v1.16.0 - 2023/03/29
4
165
 
5
166
  ### Enhancement
data/CONTRIBUTING.md CHANGED
@@ -27,7 +27,7 @@ submitting an issue to Fluentd. Even better you can submit a Pull Request with a
27
27
  * **Documentation**: Use [fluentd documentation](https://github.com/fluent/fluentd-docs-gitbook) repository.
28
28
 
29
29
  If you find a bug of 3rd party plugins, please submit an issue to each plugin repository.
30
- And use [omnibus-td-agent](https://github.com/treasure-data/omnibus-td-agent) repository for td-agent related issues.
30
+ And use [fluent-package-builder](https://github.com/fluent/fluent-package-builder) repository for td-agent related issues.
31
31
 
32
32
  Note: Before report the issue, check latest version first. Sometimes users report fixed bug with older version.
33
33
 
data/MAINTAINERS.md CHANGED
@@ -3,11 +3,11 @@
3
3
  - [Naotoshi Seo](https://github.com/sonots), [ZOZO Technologies](https://tech.zozo.com/en/)
4
4
  - [Okkez](https://github.com/okkez)
5
5
  - [Hiroshi Hatake](https://github.com/cosmo0920), [Calyptia](https://calyptia.com/)
6
- - [Masahiro Nakagawa](https://github.com/repeatedly), [Treasure Data](https://www.treasuredata.com/)
7
- - [Satoshi Tagomori](https://github.com/tagomoris), [Treasure Data](https://www.treasuredata.com/)
6
+ - [Masahiro Nakagawa](https://github.com/repeatedly)
7
+ - [Satoshi Tagomori](https://github.com/tagomoris)
8
8
  - [Toru Takahashi](https://github.com/toru-takahashi), [Treasure Data](https://www.treasuredata.com/)
9
9
  - [Eduardo Silva](https://github.com/edsiper), [Calyptia](https://calyptia/)
10
- - [Fujimoto Seiji](https://github.com/fujimots), [ClearCode](https://www.clear-code.com/)
10
+ - [Fujimoto Seiji](https://github.com/fujimots)
11
11
  - [Takuro Ashie](https://github.com/ashie), [ClearCode](https://www.clear-code.com/)
12
12
  - [Kentaro Hayashi](https://github.com/kenhys), [ClearCode](https://www.clear-code.com/)
13
13
  - [Daijiro Fukuda](https://github.com/daipom), [ClearCode](https://www.clear-code.com/)
data/README.md CHANGED
@@ -71,5 +71,3 @@ See [SECURITY](SECURITY.md) to contact us about vulnerability.
71
71
  ## Contributors:
72
72
 
73
73
  Patches contributed by [great developers](https://github.com/fluent/fluentd/contributors).
74
-
75
- [<img src="https://ga-beacon.appspot.com/UA-24890265-6/fluent/fluentd" />](https://github.com/fluent/fluentd)
data/SECURITY.md CHANGED
@@ -4,15 +4,11 @@
4
4
 
5
5
  | Version | Supported |
6
6
  | ------- | ------------------ |
7
- | 1.14.x | :white_check_mark: |
8
- | <= 1.13.x | :x: |
7
+ | 1.16.x | :white_check_mark: |
8
+ | 1.15.x | :white_check_mark: |
9
+ | <= 1.14.x | :x: |
9
10
 
10
11
  ## Reporting a Vulnerability
11
12
 
12
- Please contact to current active maintainers. (in alphabetical order)
13
-
14
- * ashie@clear-code.com
15
- * fujimoto@clear-code.com
16
- * hatake@calyptia.com
17
- * hayashi@clear-code.com
18
-
13
+ Please post your vulnerability report from the following page:
14
+ https://github.com/fluent/fluentd/security/advisories
data/fluentd.gemspec CHANGED
@@ -24,11 +24,17 @@ Gem::Specification.new do |gem|
24
24
  gem.add_runtime_dependency("cool.io", [">= 1.4.5", "< 2.0.0"])
25
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
- gem.add_runtime_dependency("sigdump", ["~> 0.2.2"])
27
+ gem.add_runtime_dependency("sigdump", ["~> 0.2.5"])
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
31
  gem.add_runtime_dependency("webrick", ["~> 1.4"])
32
+ gem.add_runtime_dependency("console", ["< 1.24"])
33
+
34
+ # gems that aren't default gems as of Ruby 3.5
35
+ # logger 1.6.3 or later cause bug on windows,
36
+ # hold on 1.6.2 for a while. see https://github.com/ruby/logger/issues/107
37
+ gem.add_runtime_dependency("logger", ["1.6.2"])
32
38
 
33
39
  # build gem for a certain platform. see also Rakefile
34
40
  fake_platform = ENV['GEM_BUILD_FAKE_PLATFORM'].to_s
@@ -45,7 +51,9 @@ Gem::Specification.new do |gem|
45
51
  gem.add_development_dependency("parallel_tests", ["~> 0.15.3"])
46
52
  gem.add_development_dependency("simplecov", ["~> 0.7"])
47
53
  gem.add_development_dependency("rr", ["~> 3.0"])
48
- gem.add_development_dependency("timecop", ["~> 0.9"])
54
+ # timecop v0.9.9 supports `Process.clock_gettime`. It breaks some tests.
55
+ # (https://github.com/fluent/fluentd/pull/4521)
56
+ gem.add_development_dependency("timecop", ["< 0.9.9"])
49
57
  gem.add_development_dependency("test-unit", ["~> 3.3"])
50
58
  gem.add_development_dependency("test-unit-rr", ["~> 1.0"])
51
59
  gem.add_development_dependency("oj", [">= 2.14", "< 4"])
@@ -92,7 +92,7 @@ module Fluent
92
92
 
93
93
  def call
94
94
  if Fluent.windows?
95
- if @pid_or_svcname =~ /^[0-9]+$/
95
+ if /^[0-9]+$/.match?(@pid_or_svcname)
96
96
  # Use as PID
97
97
  return call_windows_event(@command, "fluentd_#{@pid_or_svcname}")
98
98
  end
@@ -172,7 +172,7 @@ module Fluent
172
172
  usage("PID or SVCNAME isn't specified!") if @pid_or_svcname.nil? || @pid_or_svcname.empty?
173
173
  else
174
174
  usage("PID isn't specified!") if @pid_or_svcname.nil? || @pid_or_svcname.empty?
175
- usage("Invalid PID: #{pid}") unless @pid_or_svcname =~ /^[0-9]+$/
175
+ usage("Invalid PID: #{pid}") unless /^[0-9]+$/.match?(@pid_or_svcname)
176
176
  end
177
177
  end
178
178
  end
@@ -46,7 +46,7 @@ op.on('--show-plugin-config=PLUGIN', "[DEPRECATED] Show PLUGIN configuration and
46
46
  }
47
47
 
48
48
  op.on('-p', '--plugin DIR', "add plugin directory") {|s|
49
- (cmd_opts[:plugin_dirs] ||= []) << s
49
+ (cmd_opts[:plugin_dirs] ||= default_opts[:plugin_dirs]) << s
50
50
  }
51
51
 
52
52
  op.on('-I PATH', "add library path") {|s|
@@ -61,7 +61,7 @@ class FluentPluginConfigFormatter
61
61
  @plugin.class.ancestors.reverse_each do |plugin_class|
62
62
  next unless plugin_class.respond_to?(:dump_config_definition)
63
63
  unless @verbose
64
- next if plugin_class.name =~ /::PluginHelper::/
64
+ next if /::PluginHelper::/.match?(plugin_class.name)
65
65
  end
66
66
  dumped_config_definition = plugin_class.dump_config_definition
67
67
  dumped_config[plugin_class.name] = dumped_config_definition unless dumped_config_definition.empty?
@@ -110,7 +110,7 @@ module Fluent
110
110
 
111
111
  def include(*args)
112
112
  ::Kernel.raise ::ArgumentError, "#{name} block requires arguments for include path" if args.nil? || args.size != 1
113
- if args.first =~ /\.rb$/
113
+ if /\.rb$/.match?(args.first)
114
114
  path = File.expand_path(args.first)
115
115
  data = File.read(path)
116
116
  self.instance_eval(data, path)
@@ -150,8 +150,8 @@ module Fluent
150
150
  def eval_include(attrs, elems, uri)
151
151
  # replace space(s)(' ') with '+' to prevent invalid uri due to space(s).
152
152
  # See: https://github.com/fluent/fluentd/pull/2780#issuecomment-576081212
153
- u = URI.parse(uri.gsub(/ /, '+'))
154
- if u.scheme == 'file' || (!u.scheme.nil? && u.scheme.length == 1) || u.path == uri.gsub(/ /, '+') # file path
153
+ u = URI.parse(uri.tr(' ', '+'))
154
+ if u.scheme == 'file' || (!u.scheme.nil? && u.scheme.length == 1) || u.path == uri.tr(' ', '+') # file path
155
155
  # When the Windows absolute path then u.scheme.length == 1
156
156
  # e.g. C:
157
157
  path = URI.decode_www_form_component(u.path)
@@ -138,6 +138,10 @@ module Fluent
138
138
  sb.add_line('@id', v)
139
139
  end
140
140
 
141
+ if (v = config.delete('$log_level'))
142
+ sb.add_line('@log_level', v)
143
+ end
144
+
141
145
  config.each do |key, val|
142
146
  if val.is_a?(Array)
143
147
  val.each do |v|
@@ -27,7 +27,7 @@ module Fluent
27
27
  DEFAULT_PORT = 24321
28
28
 
29
29
  def initialize(name, opt = {})
30
- raise 'Counter server name is invalid' unless Validator::VALID_NAME =~ name
30
+ raise 'Counter server name is invalid' unless Validator::VALID_NAME.match?(name)
31
31
  @name = name
32
32
  @opt = opt
33
33
  @addr = @opt[:addr] || DEFAULT_ADDR
@@ -82,7 +82,7 @@ module Fluent
82
82
  raise Fluent::Counter::InvalidParams.new('The type of `key` should be String')
83
83
  end
84
84
 
85
- unless VALID_NAME =~ name
85
+ unless VALID_NAME.match?(name)
86
86
  raise Fluent::Counter::InvalidParams.new('`key` is the invalid format')
87
87
  end
88
88
  end
@@ -92,7 +92,7 @@ module Fluent
92
92
  raise Fluent::Counter::InvalidParams.new('The type of `scope` should be String')
93
93
  end
94
94
 
95
- unless VALID_SCOPE_NAME =~ name
95
+ unless VALID_SCOPE_NAME.match?(name)
96
96
  raise Fluent::Counter::InvalidParams.new('`scope` is the invalid format')
97
97
  end
98
98
  end
@@ -109,7 +109,7 @@ module Fluent
109
109
  raise Fluent::Counter::InvalidParams.new('The type of `name` should be String')
110
110
  end
111
111
 
112
- unless VALID_NAME =~ name
112
+ unless VALID_NAME.match?(name)
113
113
  raise Fluent::Counter::InvalidParams.new("`name` is the invalid format")
114
114
  end
115
115
  end
data/lib/fluent/engine.rb CHANGED
@@ -68,7 +68,7 @@ module Fluent
68
68
  end
69
69
 
70
70
  def parse_config(io, fname, basepath = Dir.pwd, v1_config = false)
71
- if fname =~ /\.rb$/
71
+ if /\.rb$/.match?(fname)
72
72
  require 'fluent/config/dsl'
73
73
  Config::DSL::Parser.parse(io, File.join(basepath, fname))
74
74
  else
data/lib/fluent/event.rb CHANGED
@@ -49,7 +49,7 @@ module Fluent
49
49
  raise NotImplementedError, "DO NOT USE THIS CLASS directly."
50
50
  end
51
51
 
52
- def each(unapcker: nil, &block)
52
+ def each(unpacker: nil, &block)
53
53
  raise NotImplementedError, "DO NOT USE THIS CLASS directly."
54
54
  end
55
55
 
@@ -294,7 +294,7 @@ module Fluent
294
294
  super
295
295
  end
296
296
 
297
- def to_compressed_msgpack_stream(time_int: false)
297
+ def to_compressed_msgpack_stream(time_int: false, packer: nil)
298
298
  # time_int is always ignored because @data is always packed binary in this class
299
299
  @compressed_data
300
300
  end
@@ -308,11 +308,15 @@ module Fluent
308
308
  end
309
309
 
310
310
  module ChunkMessagePackEventStreamer
311
- # chunk.extend(ChunkEventStreamer)
311
+ # chunk.extend(ChunkMessagePackEventStreamer)
312
312
  # => chunk.each{|time, record| ... }
313
313
  def each(unpacker: nil, &block)
314
+ # Note: If need to use `unpacker`, then implement it,
315
+ # e.g., `unpacker.feed_each(io.read, &block)` (Not tested)
316
+ raise NotImplementedError, "'unpacker' argument is not implemented." if unpacker
317
+
314
318
  open do |io|
315
- (unpacker || Fluent::MessagePackFactory.msgpack_unpacker(io)).each(&block)
319
+ Fluent::MessagePackFactory.msgpack_unpacker(io).each(&block)
316
320
  end
317
321
  nil
318
322
  end
data/lib/fluent/log.rb CHANGED
@@ -51,6 +51,8 @@ module Fluent
51
51
  LOG_TYPES = [LOG_TYPE_SUPERVISOR, LOG_TYPE_WORKER0, LOG_TYPE_DEFAULT].freeze
52
52
  LOG_ROTATE_AGE = %w(daily weekly monthly)
53
53
 
54
+ IGNORE_SAME_LOG_MAX_CACHE_SIZE = 1000 # If need, make this an option of system config.
55
+
54
56
  def self.str_to_level(log_level_str)
55
57
  case log_level_str.downcase
56
58
  when "trace" then LEVEL_TRACE
@@ -477,6 +479,13 @@ module Fluent
477
479
  false
478
480
  end
479
481
  else
482
+ if cached_log.size >= IGNORE_SAME_LOG_MAX_CACHE_SIZE
483
+ cached_log.reject! do |_, cached_time|
484
+ (time - cached_time) > @ignore_same_log_interval
485
+ end
486
+ end
487
+ # If the size is still over, we have no choice but to clear it.
488
+ cached_log.clear if cached_log.size >= IGNORE_SAME_LOG_MAX_CACHE_SIZE
480
489
  cached_log[message] = time
481
490
  false
482
491
  end
data/lib/fluent/match.rb CHANGED
@@ -115,7 +115,7 @@ module Fluent
115
115
  stack.last << regex.pop
116
116
  regex.push ''
117
117
 
118
- elsif c =~ /[a-zA-Z0-9_]/
118
+ elsif /[a-zA-Z0-9_]/.match?(c)
119
119
  regex.last << c
120
120
 
121
121
  else
@@ -100,7 +100,12 @@ module Fluent
100
100
  end
101
101
 
102
102
  def self.thread_local_msgpack_unpacker
103
- Thread.current[:local_msgpack_unpacker] ||= MessagePackFactory.engine_factory.unpacker
103
+ unpacker = Thread.current[:local_msgpack_unpacker]
104
+ if unpacker.nil?
105
+ return Thread.current[:local_msgpack_unpacker] = MessagePackFactory.engine_factory.unpacker
106
+ end
107
+ unpacker.reset
108
+ unpacker
104
109
  end
105
110
  end
106
111
  end
@@ -190,7 +190,7 @@ module Fluent
190
190
  # Thread::Backtrace::Location#path returns base filename or absolute path.
191
191
  # #absolute_path returns absolute_path always.
192
192
  # https://bugs.ruby-lang.org/issues/12159
193
- if location.absolute_path =~ /\/test_[^\/]+\.rb$/ # location.path =~ /test_.+\.rb$/
193
+ if /\/test_[^\/]+\.rb$/.match?(location.absolute_path) # location.path =~ /test_.+\.rb$/
194
194
  return true
195
195
  end
196
196
  end