fluent-plugin-concat 2.6.0 → 2.6.2
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.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +23 -0
- data/.github/workflows/add-to-project.yml +9 -2
- data/.github/workflows/linux.yml +17 -12
- data/.github/workflows/windows.yml +17 -6
- data/NEWS.md +16 -4
- data/README.md +36 -35
- data/fluent-plugin-concat.gemspec +1 -1
- data/lib/fluent/plugin/filter_concat.rb +17 -6
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6e3b40a3ba2937ad73962f14278075d37467c3f3a4498a0915a25736b3387e16
|
|
4
|
+
data.tar.gz: 7bdc6876112368367fc31a14b1c5b49984308a91810f15f55cb561c5b73a0d2d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d21cf56c213937fc8a506a23d0f3126d5f6df484d78983aa58b2f8c58af0263447f3a51e6b1be1998d1fa9b1b695954561e0bf12ec3a20fa47fdb9ed19c0259c
|
|
7
|
+
data.tar.gz: 5482a3a6d00f598dcabd1c91bf92502fddaf69db1b60493f42dd549282e5bdeae582c297e6c2324cf6b8b4d6150dbcf86b4dceac8ae7a1cd5cadbd65b0a316e0
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: 'github-actions'
|
|
4
|
+
directory: '/'
|
|
5
|
+
schedule:
|
|
6
|
+
interval: 'monthly'
|
|
7
|
+
groups:
|
|
8
|
+
# PR: "Security update [package] from [old] to [new]"
|
|
9
|
+
# This PR should be merged in hurry
|
|
10
|
+
security-updates:
|
|
11
|
+
applies-to: security-updates
|
|
12
|
+
patterns:
|
|
13
|
+
- '*'
|
|
14
|
+
|
|
15
|
+
# PR: "Bump [package] from [old] to [new]"
|
|
16
|
+
# No need to be merged this PR in hurry. It is enough to merge
|
|
17
|
+
# once in a month.
|
|
18
|
+
monthly-updates:
|
|
19
|
+
applies-to: version-updates
|
|
20
|
+
patterns:
|
|
21
|
+
- '*'
|
|
22
|
+
# Allow to create PR both of security and normal updates.
|
|
23
|
+
open-pull-requests-limit: 1
|
|
@@ -10,8 +10,15 @@ jobs:
|
|
|
10
10
|
name: Add issue to project
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
steps:
|
|
13
|
-
-
|
|
13
|
+
- name: Generate token
|
|
14
|
+
id: generate_token
|
|
15
|
+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
|
16
|
+
with:
|
|
17
|
+
app-id: ${{ secrets.PROJECT_APP_ID }}
|
|
18
|
+
private-key: ${{ secrets.PROJECT_APP_PRIVATE_KEY }}
|
|
19
|
+
owner: fluent
|
|
20
|
+
- uses: actions/add-to-project@5afcf98fcd03f1c2f92c3c83f58ae24323cc57fd # v2.0.0
|
|
14
21
|
with:
|
|
15
22
|
project-url: https://github.com/orgs/fluent/projects/4
|
|
16
|
-
github-token: ${{
|
|
23
|
+
github-token: ${{ steps.generate_token.outputs.token }}
|
|
17
24
|
labeled: waiting-for-triage
|
data/.github/workflows/linux.yml
CHANGED
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
name: Testing on Ubuntu
|
|
2
2
|
on:
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
push:
|
|
4
|
+
branches: [master]
|
|
5
|
+
pull_request:
|
|
6
|
+
branches: [master]
|
|
7
|
+
schedule:
|
|
8
|
+
- cron: '0 0 1 * *'
|
|
5
9
|
jobs:
|
|
10
|
+
ruby-versions:
|
|
11
|
+
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
|
|
12
|
+
with:
|
|
13
|
+
engine: cruby
|
|
14
|
+
min_version: 2.7
|
|
6
15
|
build:
|
|
16
|
+
needs: ruby-versions
|
|
7
17
|
runs-on: ${{ matrix.os }}
|
|
8
18
|
strategy:
|
|
9
19
|
fail-fast: false
|
|
10
20
|
matrix:
|
|
11
|
-
ruby:
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
- 3.1
|
|
15
|
-
- 3.2
|
|
16
|
-
- 3.3
|
|
17
|
-
- 3.4
|
|
21
|
+
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
|
|
22
|
+
exclude:
|
|
23
|
+
- ruby: head
|
|
18
24
|
os:
|
|
19
25
|
- ubuntu-latest
|
|
20
26
|
name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
|
|
21
27
|
steps:
|
|
22
|
-
- uses: actions/checkout@
|
|
23
|
-
- uses: ruby/setup-ruby@v1
|
|
28
|
+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
29
|
+
- uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0
|
|
24
30
|
with:
|
|
25
31
|
ruby-version: ${{ matrix.ruby }}
|
|
26
32
|
rubygems: latest
|
|
@@ -28,6 +34,5 @@ jobs:
|
|
|
28
34
|
env:
|
|
29
35
|
CI: true
|
|
30
36
|
run: |
|
|
31
|
-
gem install bundler rake
|
|
32
37
|
bundle install --jobs 4 --retry 3
|
|
33
38
|
bundle exec rake test
|
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
name: Testing on Windows
|
|
2
2
|
on:
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
push:
|
|
4
|
+
branches: [master]
|
|
5
|
+
pull_request:
|
|
6
|
+
branches: [master]
|
|
7
|
+
schedule:
|
|
8
|
+
- cron: '0 0 1 * *'
|
|
5
9
|
jobs:
|
|
10
|
+
ruby-versions:
|
|
11
|
+
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
|
|
12
|
+
with:
|
|
13
|
+
engine: cruby
|
|
14
|
+
min_version: 2.7
|
|
6
15
|
build:
|
|
16
|
+
needs: ruby-versions
|
|
7
17
|
runs-on: ${{ matrix.os }}
|
|
8
18
|
strategy:
|
|
9
19
|
fail-fast: false
|
|
10
20
|
matrix:
|
|
11
|
-
ruby:
|
|
21
|
+
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
|
|
22
|
+
exclude:
|
|
23
|
+
- ruby: head
|
|
12
24
|
os:
|
|
13
25
|
- windows-latest
|
|
14
26
|
name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
|
|
15
27
|
steps:
|
|
16
|
-
- uses: actions/checkout@
|
|
17
|
-
- uses: ruby/setup-ruby@v1
|
|
28
|
+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
29
|
+
- uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0
|
|
18
30
|
with:
|
|
19
31
|
ruby-version: ${{ matrix.ruby }}
|
|
20
32
|
rubygems: latest
|
|
@@ -22,6 +34,5 @@ jobs:
|
|
|
22
34
|
env:
|
|
23
35
|
CI: true
|
|
24
36
|
run: |
|
|
25
|
-
gem install bundler rake
|
|
26
37
|
bundle install --jobs 4 --retry 3
|
|
27
38
|
bundle exec rake test
|
data/NEWS.md
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
# ChangeLog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## v2.6.2
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Fixes
|
|
6
6
|
|
|
7
|
-
*
|
|
7
|
+
* Fix unbounded growth of stream state in timeout handling (#150)
|
|
8
|
+
* docs: clarify timeout handling to prevent silent log loss
|
|
9
|
+
|
|
10
|
+
## v2.6.1
|
|
11
|
+
|
|
12
|
+
### Fixes
|
|
13
|
+
|
|
14
|
+
* Fix NoMethodError when calculating bytesize of non-string record values. See #136
|
|
8
15
|
|
|
9
16
|
## v2.6.0
|
|
10
17
|
|
|
@@ -12,6 +19,12 @@
|
|
|
12
19
|
|
|
13
20
|
* Support `buffer_limit_size`, `buffer_overflow_method` to change behavior when buffer overflow. See #68
|
|
14
21
|
|
|
22
|
+
## v2.5.0
|
|
23
|
+
|
|
24
|
+
### Improvements
|
|
25
|
+
|
|
26
|
+
* adds `partial_metadata_format` to support Docker 20.10 journald log driver improvements [moby/moby#41407](https://github.com/moby/moby/pull/41407)
|
|
27
|
+
|
|
15
28
|
## v2.3.0
|
|
16
29
|
|
|
17
30
|
### Improvements
|
|
@@ -63,4 +76,3 @@
|
|
|
63
76
|
### Incompatibilities
|
|
64
77
|
|
|
65
78
|
* Flush buffer when match both `multiline_start_regexp` and `multiline_end_regexp`
|
|
66
|
-
|
data/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# fluent-plugin-concat
|
|
2
2
|
|
|
3
|
-
[](https://github.com/fluent-plugins-nursery/fluent-plugin-concat/actions/workflows/linux.yml)
|
|
4
|
+
[](https://github.com/fluent-plugins-nursery/fluent-plugin-concat/actions/workflows/windows.yml)
|
|
4
5
|
|
|
5
6
|
Fluentd Filter plugin to concatenate multiline log separated in multiple events.
|
|
6
7
|
|
|
@@ -123,40 +124,6 @@ Specify first line of multiline by regular expression.
|
|
|
123
124
|
</filter>
|
|
124
125
|
```
|
|
125
126
|
|
|
126
|
-
You can handle timeout events and remaining buffers on shutdown this plugin.
|
|
127
|
-
|
|
128
|
-
```aconf
|
|
129
|
-
<label @ERROR>
|
|
130
|
-
<match docker.log>
|
|
131
|
-
@type file
|
|
132
|
-
path /path/to/error.log
|
|
133
|
-
</match>
|
|
134
|
-
</label>
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
Handle timeout log lines the same as normal logs.
|
|
138
|
-
|
|
139
|
-
```aconf
|
|
140
|
-
<filter **>
|
|
141
|
-
@type concat
|
|
142
|
-
key message
|
|
143
|
-
multiline_start_regexp /^Start/
|
|
144
|
-
flush_interval 5
|
|
145
|
-
timeout_label @NORMAL
|
|
146
|
-
</filter>
|
|
147
|
-
|
|
148
|
-
<match **>
|
|
149
|
-
@type relabel
|
|
150
|
-
@label @NORMAL
|
|
151
|
-
</match>
|
|
152
|
-
|
|
153
|
-
<label @NORMAL>
|
|
154
|
-
<match **>
|
|
155
|
-
@type stdout
|
|
156
|
-
</match>
|
|
157
|
-
</label>
|
|
158
|
-
```
|
|
159
|
-
|
|
160
127
|
Handle single line JSON from Docker containers.
|
|
161
128
|
|
|
162
129
|
```aconf
|
|
@@ -251,6 +218,40 @@ Handle containerd/cri in Kubernetes.
|
|
|
251
218
|
</label>
|
|
252
219
|
```
|
|
253
220
|
|
|
221
|
+
### Timeout Handling and Preventing Log Loss
|
|
222
|
+
|
|
223
|
+
When a multiline log is incomplete and reaches the `flush_interval`, the plugin flushes the remaining buffer. **These timeout events are routed to the `@ERROR` label by default**.
|
|
224
|
+
|
|
225
|
+
**If you do not explicitly handle these timeout events, your last log lines will be silently dropped.**
|
|
226
|
+
|
|
227
|
+
To prevent data loss and handle timeout logs the same as normal logs, you **must** configure `timeout_label` and set up a corresponding `<label>` block to catch and route them properly.
|
|
228
|
+
|
|
229
|
+
#### Example: Safely rescuing timeout logs
|
|
230
|
+
|
|
231
|
+
```aconf
|
|
232
|
+
<filter **>
|
|
233
|
+
@type concat
|
|
234
|
+
key message
|
|
235
|
+
multiline_start_regexp /^Start/
|
|
236
|
+
flush_interval 5
|
|
237
|
+
# 1. Route timeout events to a specific label
|
|
238
|
+
timeout_label @NORMAL
|
|
239
|
+
</filter>
|
|
240
|
+
|
|
241
|
+
# 2. Route normal events to the same label
|
|
242
|
+
<match **>
|
|
243
|
+
@type relabel
|
|
244
|
+
@label @NORMAL
|
|
245
|
+
</match>
|
|
246
|
+
|
|
247
|
+
# 3. Handle both normal and timeout events together
|
|
248
|
+
<label @NORMAL>
|
|
249
|
+
<match **>
|
|
250
|
+
@type stdout
|
|
251
|
+
</match>
|
|
252
|
+
</label>
|
|
253
|
+
```
|
|
254
|
+
|
|
254
255
|
## Contributing
|
|
255
256
|
|
|
256
257
|
1. Fork it
|
|
@@ -300,7 +300,7 @@ module Fluent::Plugin
|
|
|
300
300
|
end
|
|
301
301
|
if force_flush && @buffer_overflow_method == :new
|
|
302
302
|
@buffer[stream_identity] << [tag, time, record]
|
|
303
|
-
@buffer_size[stream_identity] =
|
|
303
|
+
@buffer_size[stream_identity] = record_bytesize(record)
|
|
304
304
|
if @partial_value != record[@partial_key]
|
|
305
305
|
new_time, new_record = flush_buffer(stream_identity)
|
|
306
306
|
time = new_time if @use_first_timestamp
|
|
@@ -403,7 +403,7 @@ module Fluent::Plugin
|
|
|
403
403
|
end
|
|
404
404
|
|
|
405
405
|
def overflow?(stream_identity, record)
|
|
406
|
-
size =
|
|
406
|
+
size = record_bytesize(record)
|
|
407
407
|
if @buffer_size[stream_identity] + size > @buffer_limit_size
|
|
408
408
|
@buffer_size[stream_identity] = 0
|
|
409
409
|
true
|
|
@@ -433,20 +433,27 @@ module Fluent::Plugin
|
|
|
433
433
|
|
|
434
434
|
def flush_timeout_buffer
|
|
435
435
|
now = Fluent::Engine.now
|
|
436
|
-
|
|
436
|
+
expired_stream_identities = []
|
|
437
437
|
@timeout_map_mutex.synchronize do
|
|
438
438
|
@timeout_map.each do |stream_identity, previous_timestamp|
|
|
439
439
|
next if @flush_interval > (now - previous_timestamp)
|
|
440
|
+
expired_stream_identities << stream_identity
|
|
440
441
|
next if @buffer[stream_identity].empty?
|
|
441
442
|
time, flushed_record = flush_buffer(stream_identity)
|
|
442
|
-
timeout_stream_identities << stream_identity
|
|
443
443
|
tag = stream_identity.split(":").first
|
|
444
444
|
message = "Timeout flush: #{stream_identity}"
|
|
445
445
|
handle_timeout_error(tag, @use_first_timestamp ? time : now, flushed_record, message)
|
|
446
446
|
log.info(message)
|
|
447
447
|
end
|
|
448
|
-
|
|
449
|
-
|
|
448
|
+
# Purge expired streams from all the state hashes, not only the
|
|
449
|
+
# flushed ones. Streams which completed normally leave empty entries
|
|
450
|
+
# behind, so @buffer/@buffer_size/@timeout_map would otherwise grow
|
|
451
|
+
# unboundedly (notably in partial metadata mode where every split
|
|
452
|
+
# message has a unique stream identity).
|
|
453
|
+
expired_stream_identities.each do |stream_identity|
|
|
454
|
+
@timeout_map.delete(stream_identity)
|
|
455
|
+
@buffer.delete(stream_identity)
|
|
456
|
+
@buffer_size.delete(stream_identity)
|
|
450
457
|
end
|
|
451
458
|
end
|
|
452
459
|
end
|
|
@@ -475,6 +482,10 @@ module Fluent::Plugin
|
|
|
475
482
|
router.emit_error_event(tag, time, record, TimeoutError.new(message))
|
|
476
483
|
end
|
|
477
484
|
end
|
|
485
|
+
|
|
486
|
+
def record_bytesize(record)
|
|
487
|
+
record.keys.sum(&:bytesize) + record.values.sum { |v| v.to_s.bytesize }
|
|
488
|
+
end
|
|
478
489
|
end
|
|
479
490
|
end
|
|
480
491
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fluent-plugin-concat
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.6.
|
|
4
|
+
version: 2.6.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kenji Okimoto
|
|
@@ -123,6 +123,7 @@ files:
|
|
|
123
123
|
- ".github/ISSUE_TEMPLATE/bug_report.yml"
|
|
124
124
|
- ".github/ISSUE_TEMPLATE/config.yml"
|
|
125
125
|
- ".github/ISSUE_TEMPLATE/feature_request.yml"
|
|
126
|
+
- ".github/dependabot.yml"
|
|
126
127
|
- ".github/workflows/add-to-project.yml"
|
|
127
128
|
- ".github/workflows/linux.yml"
|
|
128
129
|
- ".github/workflows/windows.yml"
|
|
@@ -154,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
154
155
|
- !ruby/object:Gem::Version
|
|
155
156
|
version: '0'
|
|
156
157
|
requirements: []
|
|
157
|
-
rubygems_version:
|
|
158
|
+
rubygems_version: 4.0.10
|
|
158
159
|
specification_version: 4
|
|
159
160
|
summary: Fluentd Filter plugin to concat multiple event messages
|
|
160
161
|
test_files: []
|