-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
GELF (Graylog Extended Format) driver does not handle partial log lines or log metadata #43162
Comments
Thanks for opening this ticket; it looks indeed that #35831 only updated some of the logging drivers, but other logging drivers do not (yet) take advantage of the additional metadata. I'm not super-familiar with the Gelf specs, but a quick look at the docs shows that there's some support for partial messages, mentioned in the "chunking" section; https://docs.graylog.org/docs/gelf
But I'm not sure if that's a viable solution;
So to support GELF "native" chunking, I think the only solution would be to have support for this in the GELF spec (use a combination of "start of chunk" and "end of chunk" prefixes, without requiring the total number to be passed). AlternativesAn alternative would be to include the metadata as attributes on log messages that are sent to GELF (using |
I would propose that another possible though not ideal solution would be to modify the GELF driver to work like the jsonfilelog code where the docker log driver reassembles the message. The fluentd driver passes on the partial message with metadata. The jsonfilelog driver appears to append lines until until PLogMetaData.last is true (or PLogMetaData is nil) and then sends the message buffer (unless I'm reading that code incorrectly). While ideally, the log driver would simply pass on the partial message and data needed to reassemble, that does not seem to be possible for some drivers where partial metadata as Docker provides is not supported. Reassembling lines as jsonfilelog does would at least provide functional processing without the requirement that the protocol supports partial messages in Docker format. As things stand, the GELF driver produces breaking output for any systems relying upon log data where an output line exceeds 16k. Ansible AWX is a solid example of this currently. If Docker is using GELF and running AWX with Kubernetes in the environment, STDOUT and STDERR gathered by AWX controllers from the AWX Execution Environments becomes gibberish and breaks AWX. (I understand this is not necessarily "Docker's problem", I simply provided my current use case where this was found as an example where the 16k limit is directly breaking products due to lack of support). |
The reassembling for the json-file logging driver happens when reading the logs ( |
GELF logging driver does not handle log metadata and therefore does not handle docker partial log line reassembly or passing of the metadata to a downstream processor.
Steps to reproduce the issue:
Describe the results you received:
GELF generated logs from lines greater than 16K are missing the required metadata for proper reassembly and they are improperly concatenated onto each other. This issue was found running Ansible AWX 19.X in a kubernetes environment configured to use GELF. When an ansible command generates an output line greater than 16k, Docker splits the line at 16k and the GELF driver messes up the output data and thereby breaks the AWX GUI because the log lines are no longer parsable JSON.
Describe the results you expected:
Expect to see either the full 16K+ log line reassembled properly or a log message containing the partial log line metadata and the partial log message.
Additional information you deem important (e.g. issue happens only occasionally):
Looking at the source code in daemon/logger, jsonfilelog appears to have been modified to handle partial log lines by concatenating log lines until PLogMetaData.last is true (or PLogMetaData is nil).
Fluentd appears to have been updated to read metadata from the PLogMetaData and post it along with the message content.
The GELF driver seems to have no processing of PLogMetaData at all and therefor passes the message through without concatenating and without any metadata needed to reassemble the messages.
Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.):
The text was updated successfully, but these errors were encountered: