fluent-plugin-concat 2.6.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57c16827309de887d99790f740319040ac08b1ab8e137d8c99caa7f8c71b68f0
4
- data.tar.gz: 99ac67b840a21e911128cff0123426f11911f1c4baf7324eaab4f1f615dbf160
3
+ metadata.gz: 6e3b40a3ba2937ad73962f14278075d37467c3f3a4498a0915a25736b3387e16
4
+ data.tar.gz: 7bdc6876112368367fc31a14b1c5b49984308a91810f15f55cb561c5b73a0d2d
5
5
  SHA512:
6
- metadata.gz: 8fc317393e1dfbdb7cecc39e0fb045ee82ea93f4f21e3a0f377c460b0df6b0d89f0ef1cd4ff11aeb20a99f7ae3134a4ddd7c96e7166fceca46c4f4ad36f4b168
7
- data.tar.gz: 20661b96b7799c0484c98a7b9ece9376b4b004d7b3e054c7eb3b3de0c9c760ba6354d72b8f3e8025284f4dad85afe2a08ec3dc69f11df8f6359493a6a15ba496
6
+ metadata.gz: d21cf56c213937fc8a506a23d0f3126d5f6df484d78983aa58b2f8c58af0263447f3a51e6b1be1998d1fa9b1b695954561e0bf12ec3a20fa47fdb9ed19c0259c
7
+ data.tar.gz: 5482a3a6d00f598dcabd1c91bf92502fddaf69db1b60493f42dd549282e5bdeae582c297e6c2324cf6b8b4d6150dbcf86b4dceac8ae7a1cd5cadbd65b0a316e0
@@ -4,3 +4,20 @@ updates:
4
4
  directory: '/'
5
5
  schedule:
6
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
@@ -12,12 +12,12 @@ jobs:
12
12
  steps:
13
13
  - name: Generate token
14
14
  id: generate_token
15
- uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
15
+ uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
16
16
  with:
17
17
  app-id: ${{ secrets.PROJECT_APP_ID }}
18
18
  private-key: ${{ secrets.PROJECT_APP_PRIVATE_KEY }}
19
19
  owner: fluent
20
- - uses: actions/add-to-project@244f685bbc3b7adfa8466e08b698b5577571133e # v1.0.2
20
+ - uses: actions/add-to-project@5afcf98fcd03f1c2f92c3c83f58ae24323cc57fd # v2.0.0
21
21
  with:
22
22
  project-url: https://github.com/orgs/fluent/projects/4
23
23
  github-token: ${{ steps.generate_token.outputs.token }}
@@ -25,8 +25,8 @@ jobs:
25
25
  - ubuntu-latest
26
26
  name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
27
27
  steps:
28
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
29
- - uses: ruby/setup-ruby@6ca151fd1bfcfd6fe0c4eb6837eb0584d0134a0c # v1.290.0
28
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
29
+ - uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0
30
30
  with:
31
31
  ruby-version: ${{ matrix.ruby }}
32
32
  rubygems: latest
@@ -25,8 +25,8 @@ jobs:
25
25
  - windows-latest
26
26
  name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
27
27
  steps:
28
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
29
- - uses: ruby/setup-ruby@6ca151fd1bfcfd6fe0c4eb6837eb0584d0134a0c # v1.290.0
28
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
29
+ - uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0
30
30
  with:
31
31
  ruby-version: ${{ matrix.ruby }}
32
32
  rubygems: latest
data/NEWS.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # ChangeLog
2
2
 
3
+ ## v2.6.2
4
+
5
+ ### Fixes
6
+
7
+ * Fix unbounded growth of stream state in timeout handling (#150)
8
+ * docs: clarify timeout handling to prevent silent log loss
9
+
3
10
  ## v2.6.1
4
11
 
5
12
  ### Fixes
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # fluent-plugin-concat
2
2
 
3
- [![Build Status](https://travis-ci.org/fluent-plugins-nursery/fluent-plugin-concat.svg?branch=master)](https://travis-ci.org/fluent-plugins-nursery/fluent-plugin-concat)
3
+ [![Testing on Ubuntu](https://github.com/fluent-plugins-nursery/fluent-plugin-concat/actions/workflows/linux.yml/badge.svg)](https://github.com/fluent-plugins-nursery/fluent-plugin-concat/actions/workflows/linux.yml)
4
+ [![Testing on Windows](https://github.com/fluent-plugins-nursery/fluent-plugin-concat/actions/workflows/windows.yml/badge.svg)](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
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-concat"
7
- spec.version = "2.6.1"
7
+ spec.version = "2.6.2"
8
8
  spec.authors = ["Kenji Okimoto"]
9
9
  spec.email = ["okimoto@clear-code.com"]
10
10
 
@@ -433,20 +433,27 @@ module Fluent::Plugin
433
433
 
434
434
  def flush_timeout_buffer
435
435
  now = Fluent::Engine.now
436
- timeout_stream_identities = []
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
- @timeout_map.reject! do |stream_identity, _|
449
- timeout_stream_identities.include?(stream_identity)
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
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.1
4
+ version: 2.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenji Okimoto
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0'
157
157
  requirements: []
158
- rubygems_version: 3.6.9
158
+ rubygems_version: 4.0.10
159
159
  specification_version: 4
160
160
  summary: Fluentd Filter plugin to concat multiple event messages
161
161
  test_files: []