fluentd 1.14.0.rc → 1.14.3
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/.drone.yml +6 -6
- data/.github/ISSUE_TEMPLATE/bug_report.yaml +1 -0
- data/.github/workflows/windows-test.yaml +3 -3
- data/CHANGELOG.md +126 -0
- data/README.md +2 -0
- data/SECURITY.md +18 -0
- data/fluentd.gemspec +3 -3
- data/lib/fluent/command/cat.rb +13 -3
- data/lib/fluent/config/parser.rb +1 -1
- data/lib/fluent/config/v1_parser.rb +1 -1
- data/lib/fluent/plugin/buf_file.rb +2 -2
- data/lib/fluent/plugin/buffer.rb +39 -5
- data/lib/fluent/plugin/in_http.rb +21 -2
- data/lib/fluent/plugin/in_tail.rb +43 -7
- data/lib/fluent/plugin/out_copy.rb +1 -1
- data/lib/fluent/plugin/out_forward.rb +15 -7
- data/lib/fluent/plugin/output.rb +6 -5
- data/lib/fluent/plugin/parser_apache2.rb +1 -1
- data/lib/fluent/plugin/storage_local.rb +3 -5
- data/lib/fluent/plugin_id.rb +2 -1
- data/lib/fluent/supervisor.rb +2 -2
- data/lib/fluent/time.rb +21 -20
- data/lib/fluent/version.rb +1 -1
- data/test/command/test_cat.rb +31 -2
- data/test/plugin/in_tail/test_io_handler.rb +12 -4
- data/test/plugin/test_buffer.rb +72 -1
- data/test/plugin/test_in_http.rb +40 -0
- data/test/plugin/test_in_tail.rb +74 -9
- data/test/plugin/test_out_exec_filter.rb +4 -0
- data/test/plugin_helper/test_child_process.rb +9 -9
- data/test/test_time_parser.rb +22 -0
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4863e324dc88cd23cff5f68feeb71de9cda4a0c3c4594a515e4545d2bd589105
|
4
|
+
data.tar.gz: 2b791da9f6c98d61199c2361cd6623ea01dcaff7d1e3e93aea8d98fda86df4cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9b7fb44d1801b19578bd1b6ef1c44c57a9027535909669c8bd97d19536d63157a8feef203891f257532a92a41e70f5358611fd10be2a94459f38959fd98716f
|
7
|
+
data.tar.gz: ef4958c9827c8e093c73e46a0fbf33368dcc6ccec156ed0ed8fe4b76ec91f145e53eccb263ed52996e905326bce4362d600c2665a718c047b304cb3a0ddae58e
|
data/.drone.yml
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
kind: pipeline
|
2
|
-
name: fluentd-test-arm64-
|
2
|
+
name: fluentd-test-arm64-3-0
|
3
3
|
|
4
4
|
platform:
|
5
5
|
os: linux
|
6
6
|
arch: arm64
|
7
7
|
|
8
8
|
steps:
|
9
|
-
- name: fluentd-test-arm64-
|
10
|
-
image: arm64v8/ruby:
|
9
|
+
- name: fluentd-test-arm64-3-0
|
10
|
+
image: arm64v8/ruby:3.0
|
11
11
|
commands:
|
12
12
|
- apt update
|
13
13
|
- apt -y install libgmp3-dev
|
@@ -17,15 +17,15 @@ steps:
|
|
17
17
|
- bundle exec rake test
|
18
18
|
---
|
19
19
|
kind: pipeline
|
20
|
-
name: fluentd-test-arm64-
|
20
|
+
name: fluentd-test-arm64-2-7
|
21
21
|
|
22
22
|
platform:
|
23
23
|
os: linux
|
24
24
|
arch: arm64
|
25
25
|
|
26
26
|
steps:
|
27
|
-
- name: fluentd-test-arm64-
|
28
|
-
image: arm64v8/ruby:
|
27
|
+
- name: fluentd-test-arm64-2-7
|
28
|
+
image: arm64v8/ruby:2.7
|
29
29
|
commands:
|
30
30
|
- apt update
|
31
31
|
- apt -y install libgmp3-dev
|
@@ -18,7 +18,7 @@ jobs:
|
|
18
18
|
- windows-latest
|
19
19
|
experimental: [false]
|
20
20
|
include:
|
21
|
-
- ruby-version: '3.0.
|
21
|
+
- ruby-version: '3.0.2'
|
22
22
|
os: windows-latest
|
23
23
|
experimental: true
|
24
24
|
# On Ruby 3.0, we need to use fiddle 1.0.8 or later to retrieve correct
|
@@ -28,7 +28,7 @@ jobs:
|
|
28
28
|
# * https://github.com/ruby/fiddle/issues/72
|
29
29
|
# * https://bugs.ruby-lang.org/issues/17813
|
30
30
|
# * 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.
|
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
|
32
32
|
|
33
33
|
name: Unit testing with Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}
|
34
34
|
steps:
|
@@ -38,7 +38,7 @@ jobs:
|
|
38
38
|
with:
|
39
39
|
ruby-version: ${{ matrix.ruby-version }}
|
40
40
|
- name: Add Fiddle 1.0.8
|
41
|
-
if: ${{ matrix.ruby-version == '3.0.
|
41
|
+
if: ${{ matrix.ruby-version == '3.0.2' }}
|
42
42
|
run: gem install fiddle --version 1.0.8
|
43
43
|
- name: Install dependencies
|
44
44
|
run: ridk exec bundle install
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,129 @@
|
|
1
|
+
# v1.14.3
|
2
|
+
|
3
|
+
## Release v1.14.3 - 2021/11/26
|
4
|
+
|
5
|
+
### Enhancement
|
6
|
+
|
7
|
+
* Changed to accept `http_parser.rb` 0.8.0.
|
8
|
+
`http_parser.rb` 0.8.0 is ready for Ractor.
|
9
|
+
https://github.com/fluent/fluentd/pull/3544
|
10
|
+
|
11
|
+
### Bug fix
|
12
|
+
|
13
|
+
* in_tail: Fixed a bug that no new logs are read when
|
14
|
+
`enable_stat_watcher true` and `enable_watch_timer false` is set.
|
15
|
+
https://github.com/fluent/fluentd/pull/3541
|
16
|
+
* in_tail: Fixed a bug that the beginning and initial lines are lost
|
17
|
+
after startup when `read_from_head false` and path includes wildcard '*'.
|
18
|
+
https://github.com/fluent/fluentd/pull/3542
|
19
|
+
* Fixed a bug that processing messages were lost when
|
20
|
+
BufferChunkOverflowError was thrown even though only a specific
|
21
|
+
message size exceeds chunk_limit_size.
|
22
|
+
https://github.com/fluent/fluentd/pull/3553
|
23
|
+
https://github.com/fluent/fluentd/pull/3562
|
24
|
+
|
25
|
+
### Misc
|
26
|
+
|
27
|
+
* Bump up required version of `win32-service` gem.
|
28
|
+
newer version is required to implement additional `fluent-ctl` commands.
|
29
|
+
https://github.com/fluent/fluentd/pull/3556
|
30
|
+
|
31
|
+
# v1.14.2
|
32
|
+
|
33
|
+
## Release v1.14.2 - 2021/10/29
|
34
|
+
|
35
|
+
IMPORTANT: This release contain the fix for CVE-2021-41186 -
|
36
|
+
ReDoS vulnerability in `parser_apache2`.
|
37
|
+
This vulnerability is affected from Fluentd v0.14.14 to v1.14.1.
|
38
|
+
We recommend to upgrade Fluentd to v1.14.2 or use patched version of
|
39
|
+
`parser_apache2` plugin.
|
40
|
+
|
41
|
+
### Enhancement
|
42
|
+
|
43
|
+
* fluent-cat: Add `--event-time` option to send specified event time for testing.
|
44
|
+
|
45
|
+
### Bug fix
|
46
|
+
|
47
|
+
* Fixed to generate correct epoch timestamp even after switching Daylight Saving Time
|
48
|
+
https://github.com/fluent/fluentd/pull/3524
|
49
|
+
* Fixed ReDoS vulnerability in parser_apache2.
|
50
|
+
This vulnerability is caused by a certain pattern of a broken apache log.
|
51
|
+
|
52
|
+
# v1.14.1
|
53
|
+
|
54
|
+
## Release v1.14.1 - 2021/09/29
|
55
|
+
|
56
|
+
### Enhancement
|
57
|
+
|
58
|
+
* in_tail: Added file related metrics.
|
59
|
+
These metrics should be collected same as fluent-bit's in_tail.
|
60
|
+
https://github.com/fluent/fluentd/pull/3504
|
61
|
+
* out_forward: Changed to use metrics mechanism for node statistics
|
62
|
+
https://github.com/fluent/fluentd/pull/3506
|
63
|
+
|
64
|
+
### Bug fix
|
65
|
+
|
66
|
+
* in_tail: Fixed a crash bug that it raise undefined method of eof? error.
|
67
|
+
This error may happen only when `read_bytes_limit_per_second` was specified.
|
68
|
+
https://github.com/fluent/fluentd/pull/3500
|
69
|
+
* out_forward: Fixed a bug that node statistics information is not included correctly.
|
70
|
+
https://github.com/fluent/fluentd/pull/3503
|
71
|
+
https://github.com/fluent/fluentd/pull/3507
|
72
|
+
* Fixed a error when using `@include` directive
|
73
|
+
It was occurred when http/https scheme URI is used in `@include` directive with Ruby 3.
|
74
|
+
https://github.com/fluent/fluentd/pull/3517
|
75
|
+
* out_copy: Fixed to suppress a wrong warning for `ignore_if_prev_success`
|
76
|
+
It didn't work even if a user set it.
|
77
|
+
https://github.com/fluent/fluentd/pull/3515
|
78
|
+
* Fixed not to output nanoseconds field of next retry time in warning log
|
79
|
+
Then, inappropriate labels in log are also fixed. (retry_time -> retry_times,
|
80
|
+
next_retry_seconds -> next_retry_time)
|
81
|
+
https://github.com/fluent/fluentd/pull/3518
|
82
|
+
|
83
|
+
# v1.14.0
|
84
|
+
|
85
|
+
## Release v1.14.0 - 2021/08/30
|
86
|
+
|
87
|
+
### Enhancement
|
88
|
+
|
89
|
+
* Added `enable_input_metrics`, `enable_size_metrics` system
|
90
|
+
configuration parameter
|
91
|
+
This feature might need to pay higher CPU cost, so input event metrics
|
92
|
+
features are disabled by default. These features are also enabled by
|
93
|
+
`--enable-input-metrics`,`--enable-size-metrics` command line
|
94
|
+
option.
|
95
|
+
https://github.com/fluent/fluentd/pull/3440
|
96
|
+
* Added reserved word `@ROOT` for getting root router.
|
97
|
+
This is incompatible change. Do not use `@ROOT` for label name.
|
98
|
+
https://github.com/fluent/fluentd/pull/3358
|
99
|
+
* in_syslog: Added `send_keepalive_packet` option
|
100
|
+
https://github.com/fluent/fluentd/pull/3474
|
101
|
+
* in_http: Added `cors_allow_credentials` option.
|
102
|
+
This option tells browsers whether to expose the response to
|
103
|
+
frontend when the credentials mode is "include".
|
104
|
+
https://github.com/fluent/fluentd/pull/3481
|
105
|
+
https://github.com/fluent/fluentd/pull/3491
|
106
|
+
|
107
|
+
### Bug fix
|
108
|
+
|
109
|
+
* in_tail: Fixed a bug that deleted paths are not removed
|
110
|
+
from pos file by file compaction at start up
|
111
|
+
https://github.com/fluent/fluentd/pull/3467
|
112
|
+
* in_tail: Revived a warning message of retrying unaccessible file
|
113
|
+
https://github.com/fluent/fluentd/pull/3478
|
114
|
+
* TLSServer: Fixed a crash bug on logging peer host name errors
|
115
|
+
https://github.com/fluent/fluentd/pull/3483
|
116
|
+
|
117
|
+
### Misc
|
118
|
+
|
119
|
+
* Added metrics plugin mechanism
|
120
|
+
The implementations is changed to use metrics plugin.
|
121
|
+
In the future, 3rd party plugin will be able to handle these metrics.
|
122
|
+
https://github.com/fluent/fluentd/pull/3471
|
123
|
+
https://github.com/fluent/fluentd/pull/3473
|
124
|
+
https://github.com/fluent/fluentd/pull/3479
|
125
|
+
https://github.com/fluent/fluentd/pull/3484
|
126
|
+
|
1
127
|
# v1.13.3
|
2
128
|
|
3
129
|
## Release v1.13.3 - 2021/07/27
|
data/README.md
CHANGED
@@ -88,6 +88,8 @@ You can run specified test via `TEST` environment variable:
|
|
88
88
|
|
89
89
|
A third party security audit was performed by Cure53, you can see the full report [here](docs/SECURITY_AUDIT.pdf).
|
90
90
|
|
91
|
+
See [SECURITY](SECURITY.md) to contact us about vulnerability.
|
92
|
+
|
91
93
|
## Contributors:
|
92
94
|
|
93
95
|
Patches contributed by [great developers](https://github.com/fluent/fluentd/contributors).
|
data/SECURITY.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Security Policy
|
2
|
+
|
3
|
+
## Supported Versions
|
4
|
+
|
5
|
+
| Version | Supported |
|
6
|
+
| ------- | ------------------ |
|
7
|
+
| 1.14.x | :white_check_mark: |
|
8
|
+
| <= 1.13.x | :x: |
|
9
|
+
|
10
|
+
## Reporting a Vulnerability
|
11
|
+
|
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
|
+
|
data/fluentd.gemspec
CHANGED
@@ -23,11 +23,11 @@ Gem::Specification.new do |gem|
|
|
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
25
|
gem.add_runtime_dependency("serverengine", [">= 2.2.2", "< 3.0.0"])
|
26
|
-
gem.add_runtime_dependency("http_parser.rb", [">= 0.5.1", "< 0.
|
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
|
-
gem.add_runtime_dependency("strptime", [">= 0.2.
|
30
|
+
gem.add_runtime_dependency("strptime", [">= 0.2.4", "< 1.0.0"])
|
31
31
|
gem.add_runtime_dependency("webrick", [">= 1.4.2", "< 1.8.0"])
|
32
32
|
|
33
33
|
# build gem for a certain platform. see also Rakefile
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |gem|
|
|
35
35
|
gem.platform = fake_platform unless fake_platform.empty?
|
36
36
|
if /mswin|mingw/ =~ fake_platform || (/mswin|mingw/ =~ RUBY_PLATFORM && fake_platform.empty?)
|
37
37
|
gem.add_runtime_dependency("win32-api", [">= 1.10", "< 2.0.0"])
|
38
|
-
gem.add_runtime_dependency("win32-service", ["~> 2.
|
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
41
|
gem.add_runtime_dependency("windows-pr", ["~> 1.2.6"])
|
data/lib/fluent/command/cat.rb
CHANGED
@@ -35,6 +35,7 @@ format = 'json'
|
|
35
35
|
message_key = 'message'
|
36
36
|
time_as_integer = false
|
37
37
|
retry_limit = 5
|
38
|
+
event_time = nil
|
38
39
|
|
39
40
|
op.on('-p', '--port PORT', "fluent tcp port (default: #{port})", Integer) {|i|
|
40
41
|
port = i
|
@@ -80,6 +81,10 @@ op.on('--retry-limit N', "Specify the number of retry limit (default: #{retry_li
|
|
80
81
|
retry_limit = n
|
81
82
|
}
|
82
83
|
|
84
|
+
op.on('--event-time TIME_STRING', "Specify the time expression string (default: nil)") {|v|
|
85
|
+
event_time = v
|
86
|
+
}
|
87
|
+
|
83
88
|
singleton_class.module_eval do
|
84
89
|
define_method(:usage) do |msg|
|
85
90
|
puts op.to_s
|
@@ -134,7 +139,7 @@ class Writer
|
|
134
139
|
end
|
135
140
|
end
|
136
141
|
|
137
|
-
def initialize(tag, connector, time_as_integer: false, retry_limit: 5)
|
142
|
+
def initialize(tag, connector, time_as_integer: false, retry_limit: 5, event_time: nil)
|
138
143
|
@tag = tag
|
139
144
|
@connector = connector
|
140
145
|
@socket = false
|
@@ -148,6 +153,7 @@ class Writer
|
|
148
153
|
@retry_wait = 1
|
149
154
|
@retry_limit = retry_limit
|
150
155
|
@time_as_integer = time_as_integer
|
156
|
+
@event_time = event_time
|
151
157
|
|
152
158
|
super()
|
153
159
|
end
|
@@ -166,7 +172,11 @@ class Writer
|
|
166
172
|
end
|
167
173
|
end
|
168
174
|
|
169
|
-
time =
|
175
|
+
time = if @event_time
|
176
|
+
Fluent::EventTime.parse(@event_time)
|
177
|
+
else
|
178
|
+
Fluent::EventTime.now
|
179
|
+
end
|
170
180
|
time = time.to_i if @time_as_integer
|
171
181
|
entry = if secondary_record?(record)
|
172
182
|
# Even though secondary contains Fluent::EventTime in record,
|
@@ -309,7 +319,7 @@ else
|
|
309
319
|
}
|
310
320
|
end
|
311
321
|
|
312
|
-
w = Writer.new(tag, connector, time_as_integer: time_as_integer, retry_limit: retry_limit)
|
322
|
+
w = Writer.new(tag, connector, time_as_integer: time_as_integer, retry_limit: retry_limit, event_time: event_time)
|
313
323
|
w.start
|
314
324
|
|
315
325
|
case format
|
data/lib/fluent/config/parser.rb
CHANGED
@@ -172,7 +172,7 @@ module Fluent
|
|
172
172
|
require 'open-uri'
|
173
173
|
basepath = '/'
|
174
174
|
fname = path
|
175
|
-
data = open(uri) { |f| f.read }
|
175
|
+
data = URI.open(uri) { |f| f.read }
|
176
176
|
data.force_encoding('UTF-8')
|
177
177
|
ss = StringScanner.new(data)
|
178
178
|
V1Parser.new(ss, basepath, fname, @eval_context).parse_element(true, nil, attrs, elems)
|
@@ -39,8 +39,8 @@ module Fluent
|
|
39
39
|
config_set_default :chunk_limit_size, DEFAULT_CHUNK_LIMIT_SIZE
|
40
40
|
config_set_default :total_limit_size, DEFAULT_TOTAL_LIMIT_SIZE
|
41
41
|
|
42
|
-
config_param :file_permission, :string, default: nil # '0644'
|
43
|
-
config_param :dir_permission, :string, default: nil # '0755'
|
42
|
+
config_param :file_permission, :string, default: nil # '0644' (Fluent::DEFAULT_FILE_PERMISSION)
|
43
|
+
config_param :dir_permission, :string, default: nil # '0755' (Fluent::DEFAULT_DIR_PERMISSION)
|
44
44
|
|
45
45
|
def initialize
|
46
46
|
super
|
data/lib/fluent/plugin/buffer.rb
CHANGED
@@ -332,12 +332,14 @@ module Fluent
|
|
332
332
|
unstaged_chunks = {} # metadata => [chunk, chunk, ...]
|
333
333
|
chunks_to_enqueue = []
|
334
334
|
staged_bytesizes_by_chunk = {}
|
335
|
+
# track internal BufferChunkOverflowError in write_step_by_step
|
336
|
+
buffer_chunk_overflow_errors = []
|
335
337
|
|
336
338
|
begin
|
337
339
|
# sort metadata to get lock of chunks in same order with other threads
|
338
340
|
metadata_and_data.keys.sort.each do |metadata|
|
339
341
|
data = metadata_and_data[metadata]
|
340
|
-
write_once(metadata, data, format: format, size: size) do |chunk, adding_bytesize|
|
342
|
+
write_once(metadata, data, format: format, size: size) do |chunk, adding_bytesize, error|
|
341
343
|
chunk.mon_enter # add lock to prevent to be committed/rollbacked from other threads
|
342
344
|
operated_chunks << chunk
|
343
345
|
if chunk.staged?
|
@@ -352,6 +354,9 @@ module Fluent
|
|
352
354
|
unstaged_chunks[metadata] ||= []
|
353
355
|
unstaged_chunks[metadata] << chunk
|
354
356
|
end
|
357
|
+
if error && !error.empty?
|
358
|
+
buffer_chunk_overflow_errors << error
|
359
|
+
end
|
355
360
|
end
|
356
361
|
end
|
357
362
|
|
@@ -444,6 +449,10 @@ module Fluent
|
|
444
449
|
end
|
445
450
|
chunk.mon_exit rescue nil # this may raise ThreadError for chunks already committed
|
446
451
|
end
|
452
|
+
unless buffer_chunk_overflow_errors.empty?
|
453
|
+
# Notify delayed BufferChunkOverflowError here
|
454
|
+
raise BufferChunkOverflowError, buffer_chunk_overflow_errors.join(", ")
|
455
|
+
end
|
447
456
|
end
|
448
457
|
end
|
449
458
|
|
@@ -716,6 +725,7 @@ module Fluent
|
|
716
725
|
|
717
726
|
def write_step_by_step(metadata, data, format, splits_count, &block)
|
718
727
|
splits = []
|
728
|
+
errors = []
|
719
729
|
if splits_count > data.size
|
720
730
|
splits_count = data.size
|
721
731
|
end
|
@@ -761,18 +771,41 @@ module Fluent
|
|
761
771
|
begin
|
762
772
|
while writing_splits_index < splits.size
|
763
773
|
split = splits[writing_splits_index]
|
774
|
+
formatted_split = format ? format.call(split) : split.first
|
775
|
+
if split.size == 1 && original_bytesize == 0
|
776
|
+
if format == nil && @compress != :text
|
777
|
+
# The actual size of chunk is not determined until after chunk.append.
|
778
|
+
# so, keep already processed 'split' content here.
|
779
|
+
# (allow performance regression a bit)
|
780
|
+
chunk.commit
|
781
|
+
else
|
782
|
+
big_record_size = formatted_split.bytesize
|
783
|
+
if chunk.bytesize + big_record_size > @chunk_limit_size
|
784
|
+
errors << "a #{big_record_size} bytes record (nth: #{writing_splits_index}) is larger than buffer chunk limit size (#{@chunk_limit_size})"
|
785
|
+
writing_splits_index += 1
|
786
|
+
next
|
787
|
+
end
|
788
|
+
end
|
789
|
+
end
|
790
|
+
|
764
791
|
if format
|
765
|
-
chunk.concat(
|
792
|
+
chunk.concat(formatted_split, split.size)
|
766
793
|
else
|
767
794
|
chunk.append(split, compress: @compress)
|
768
795
|
end
|
769
796
|
|
770
797
|
if chunk_size_over?(chunk) # split size is larger than difference between size_full? and size_over?
|
798
|
+
adding_bytes = chunk.instance_eval { @adding_bytes } || "N/A" # 3rd party might not have 'adding_bytes'
|
771
799
|
chunk.rollback
|
772
800
|
|
773
801
|
if split.size == 1 && original_bytesize == 0
|
774
|
-
|
775
|
-
|
802
|
+
# It is obviously case that BufferChunkOverflowError should be raised here,
|
803
|
+
# but if it raises here, already processed 'split' or
|
804
|
+
# the proceeding 'split' will be lost completely.
|
805
|
+
# so it is a last resort to delay raising such a exception
|
806
|
+
errors << "concatenated/appended a #{adding_bytes} bytes record (nth: #{writing_splits_index}) is larger than buffer chunk limit size (#{@chunk_limit_size})"
|
807
|
+
writing_splits_index += 1
|
808
|
+
next
|
776
809
|
end
|
777
810
|
|
778
811
|
if chunk_size_full?(chunk) || split.size == 1
|
@@ -795,7 +828,8 @@ module Fluent
|
|
795
828
|
raise
|
796
829
|
end
|
797
830
|
|
798
|
-
block.call(chunk, chunk.bytesize - original_bytesize)
|
831
|
+
block.call(chunk, chunk.bytesize - original_bytesize, errors)
|
832
|
+
errors = []
|
799
833
|
end
|
800
834
|
end
|
801
835
|
rescue ShouldRetry
|
@@ -74,6 +74,8 @@ module Fluent::Plugin
|
|
74
74
|
config_param :blocking_timeout, :time, default: 0.5
|
75
75
|
desc 'Set a allow list of domains that can do CORS (Cross-Origin Resource Sharing)'
|
76
76
|
config_param :cors_allow_origins, :array, default: nil
|
77
|
+
desc 'Tells browsers whether to expose the response to frontend when the credentials mode is "include".'
|
78
|
+
config_param :cors_allow_credentials, :bool, default: false
|
77
79
|
desc 'Respond with empty gif image of 1x1 pixel.'
|
78
80
|
config_param :respond_with_empty_img, :bool, default: false
|
79
81
|
desc 'Respond status code with 204.'
|
@@ -112,6 +114,12 @@ module Fluent::Plugin
|
|
112
114
|
|
113
115
|
super
|
114
116
|
|
117
|
+
if @cors_allow_credentials
|
118
|
+
if @cors_allow_origins.nil? || @cors_allow_origins.include?('*')
|
119
|
+
raise Fluent::ConfigError, "Cannot enable cors_allow_credentials without specific origins"
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
115
123
|
m = if @parser_configs.first['@type'] == 'in_http'
|
116
124
|
@parser_msgpack = parser_create(usage: 'parser_in_http_msgpack', type: 'msgpack')
|
117
125
|
@parser_msgpack.time_key = nil
|
@@ -279,7 +287,10 @@ module Fluent::Plugin
|
|
279
287
|
private
|
280
288
|
|
281
289
|
def on_server_connect(conn)
|
282
|
-
handler = Handler.new(conn, @km, method(:on_request),
|
290
|
+
handler = Handler.new(conn, @km, method(:on_request),
|
291
|
+
@body_size_limit, @format_name, log,
|
292
|
+
@cors_allow_origins, @cors_allow_credentials,
|
293
|
+
@add_query_params)
|
283
294
|
|
284
295
|
conn.on(:data) do |data|
|
285
296
|
handler.on_read(data)
|
@@ -356,7 +367,8 @@ module Fluent::Plugin
|
|
356
367
|
class Handler
|
357
368
|
attr_reader :content_type
|
358
369
|
|
359
|
-
def initialize(io, km, callback, body_size_limit, format_name, log,
|
370
|
+
def initialize(io, km, callback, body_size_limit, format_name, log,
|
371
|
+
cors_allow_origins, cors_allow_credentials, add_query_params)
|
360
372
|
@io = io
|
361
373
|
@km = km
|
362
374
|
@callback = callback
|
@@ -365,6 +377,7 @@ module Fluent::Plugin
|
|
365
377
|
@format_name = format_name
|
366
378
|
@log = log
|
367
379
|
@cors_allow_origins = cors_allow_origins
|
380
|
+
@cors_allow_credentials = cors_allow_credentials
|
368
381
|
@idle = 0
|
369
382
|
@add_query_params = add_query_params
|
370
383
|
@km.add(self)
|
@@ -491,6 +504,9 @@ module Fluent::Plugin
|
|
491
504
|
send_response_and_close(RES_200_STATUS, header, "")
|
492
505
|
elsif include_cors_allow_origin
|
493
506
|
header["Access-Control-Allow-Origin"] = @origin
|
507
|
+
if @cors_allow_credentials
|
508
|
+
header["Access-Control-Allow-Credentials"] = true
|
509
|
+
end
|
494
510
|
send_response_and_close(RES_200_STATUS, header, "")
|
495
511
|
else
|
496
512
|
send_response_and_close(RES_403_STATUS, {}, "")
|
@@ -576,6 +592,9 @@ module Fluent::Plugin
|
|
576
592
|
header['Access-Control-Allow-Origin'] = '*'
|
577
593
|
elsif include_cors_allow_origin
|
578
594
|
header['Access-Control-Allow-Origin'] = @origin
|
595
|
+
if @cors_allow_credentials
|
596
|
+
header["Access-Control-Allow-Credentials"] = true
|
597
|
+
end
|
579
598
|
end
|
580
599
|
end
|
581
600
|
|