[20.10 backport] Handle long log messages correctly on SizedLogger#41975
Merged
Conversation
Member
Author
|
@samuelkarp @kzys @estesp ptal |
kzys
approved these changes
Feb 3, 2021
samuelkarp
approved these changes
Feb 3, 2021
Loggers that implement BufSize() (e.g. awslogs) uses the method to tell Copier about the maximum log line length. However loggerWithCache and RingBuffer hide the method by wrapping loggers. As a result, Copier uses its default 16KB limit which breaks log lines > 16kB even the destinations can handle that. This change implements BufSize() on loggerWithCache and RingBuffer to make sure these logger wrappes don't hide the method on the underlying loggers. Fixes moby#41794. Signed-off-by: Kazuyoshi Kato <[email protected]> (cherry picked from commit bb11365) Signed-off-by: Sebastiaan van Stijn <[email protected]>
thaJeztah
force-pushed
the
20.10_backport_41794_sized_logger
branch
from
February 17, 2021 20:19
351ba50 to
d13e162
Compare
Member
Author
|
rebased to trigger CI with test-fixes that were merged |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
backport of #41909
fixes #41794 "awslogs" driver with "non-blocking" mode cause log events to split larger then 16k size
Loggers that implement BufSize() (e.g. awslogs) uses the method to
tell Copier about the maximum log line length. However loggerWithCache
and RingBuffer hide the method by wrapping loggers.
As a result, Copier uses its default 16KB limit which breaks log
lines > 16kB even the destinations can handle that.
This change implements BufSize() on loggerWithCache and RingBuffer to
make sure these logger wrappes don't hide the method on the underlying
loggers.
Fixes #41794.
Signed-off-by: Kazuyoshi Kato [email protected]
- What I did
I've added BufSize() to loggerWithCache and RingLogger to make Copier aware about the size limit of the underlying loggers.
- How I did it
I've added the method to the structs.
- How to verify it
I built Docker and tested the change with
log-splitcontainer image I made.The Dockerfile for the image is below.
I also added new unit tests on Copier.
- Description for the changelog
Fix loggers to make sure they don't break long lines when the destinations' limits allow.