-
Notifications
You must be signed in to change notification settings - Fork 39k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supporting docker log splitting in Kubernetes logging integrations #52444
Comments
Presumably this should be done in the Docker fluentd logging driver... The discussion on moby/moby#34620 seems to be leaning that way... |
In fluentd logging driver side, journald driver approach is better: https://github.com/moby/moby/blob/80edccda708c6771824c245b4d634c2a9ce29795/daemon/logger/journald/journald.go#L110 In fluentd side, implementing |
@crassirostris @repeatedly @igorpeshansky do we need to block 1.8 release? can we please move this out of 1.8 if it's not? |
@dims Moved to 1.9, since it's not specific for 1.8 |
Is there any way this can be fixed by running a custom fluentd? Or is there a fluentd docker driver github issue I can follow for updates on when they expect to have this fixed? Txh |
[MILESTONENOTIFIER] Milestone Issue Needs Approval @crassirostris @kubernetes/sig-instrumentation-misc Action required: This issue must have the Issue Labels
|
Problem is that there's no fluentd plugin to fix the problem, so running a custom fluentd won't help, there's nothing to add to the configuration to make it work (unless you want to write your own solution)
They don't think it's a docker problem and don't plan to fix it. However, it will be fixed in GKE |
That seems fair from Docker's perspective. I'd rather have stable containers as well :) So you're thinking of switching from the current log drive |
No, that's not the case. Solution is TBD, but if you export your logs to Stackdriver (that has a limit of 100KB per entry) you won't see the difference |
I think there's still a difference in that the 100KB stackdriver logging limit is larger than the 16KB docker limit at which the partial messaging starts, so without proper recombination of those chunked messages you'll lose the ability to send log lines larger than 16KB into stackdriver. However we're also running our own fluentd that sends messages straight into pub/sub, which has a limit of 10MB per message. And although we're trying to keep the messages much smaller than 16KB it would be nice to be able to send bigger messages without instrumenting our applications to push the messages into pub/sub themselves. I hope you find a nice solution that will make this possible :) |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle rotten Still relevant, hasn't been fixed |
Would using the "concat" fluentd plugin be relevant? Edit: For EFK, Adding fluentd-plugin-concat to fluentd-es image (https://github.com/wiremind/kubernetes/tree/fluentd-concat/cluster/addons/fluentd-elasticsearch/fluentd-es-image, https://hub.docker.com/r/wiremind/fluentd-elasticsearch-concat/) and adding
to the Would a PR with those changes be acceptable? |
…cker into several lines. See kubernetes#52444.
trying to solve this as well. Having the same issue as @abedwardsw where long lines are being truncated and MDC gone. |
…cker into several lines. See kubernetes#52444. Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>
…cker into several lines. See kubernetes#52444. Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>
Please see
The big problem here is concurrency. Just concatenating all partial log messages as they arrive may be wrong. Let's say your app logs two events, called
The fluentd concat plugin cannot decide what to do. What records belong together? The good message is: This can be solved (similar to moby/moby#37889) as Docker logs contain all the needed information here: So you just have to extend these methods and the https://github.com/moby/moby/blob/8e610b2b55bfd1bfa9436ab110d311f5e8a74dcb/daemon/logger/jsonfilelog/jsonfilelog.go#L143 Then you have to fix fluent-plugins-nursery/fluent-plugin-concat#59: Mind the ID and ordinal of the partial log metadata so that you concatenate the right records in the correct order. |
I just edited my above comment because I am not sure how the case of linebreaks (i.e. those written by the application) in log messages relate to this issue. However, often you can control the logging of your application and let it write JSON to STDOUT (e.g. https://github.com/logstash/logstash-logback-encoder for Java / Spring Boot applications) so you do not have linebreaks. Back to the original issue: @desaintmartin: I have serious doubts that #68012 will do it under load with a lot of concurrent partial messages. I observed this in a Docker Swarm setup with fluentd and the concat plugin configured analogously. |
@crassirostris Could you please reopen this issue? The concurrency is the problem here: Let your container simultaneously produce two log messages of >16KB (let's say 20 KB). Then fluentd will concatenate all four messages to one large (16+16+4+4 KB = 40 KB) message. The fluentd (or whatever you use) needs to know the ID of the partial log metadata to concatenate only those messages with identical IDs. So this needs to be implemented in the (default) local JSON file log driver in Docker (moby). |
Problem is that ID comes with Docker 18.06 if I'm not wrong, this is why I didn't use it: do we want to require a docker version which is 2 months old? |
@crassirostris is no longer much involved with the project. if you would like to open this back up to alter the implementation, please file a new issue @ju-la-berger. |
If you do so, please ping me as well. |
@desaintmartin I have added the concat plugin
but still it is not concatenating, Any Idea? |
No idea why it does not work. For up-to-date information, I have inserted:
Just after the kubernetes_metadate injection. |
Follow-up of #52433
Docker 1.13 introduced a change into the logging mechanism (moby/moby#22982), that split the log lines longer than 16K into chunks of no more than that. Current default logging integrations (fluentd-gcp and fluentd-es addons) do not support that and this might result in broken ingestion, i.e. when JSON parsing is broken for entries longer than 16K.
One possible solution is introducing a fluentd plugin to the configuration to concat such entries in the similar way https://github.com/GoogleCloudPlatform/fluent-plugin-detect-exceptions does it (assuming there is one out there, cc @tagomoris @repeatedly @edsiper for that)
/cc @igorpeshansky @fgrzadkowski @piosz
The text was updated successfully, but these errors were encountered: