-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Stop throwing errors on blank log messages #17058
base: master
Are you sure you want to change the base?
Conversation
} | ||
} else if (!messageNode.isMissingNode()) { | ||
if (!messageNode.isTextual()) { | ||
throw new IllegalArgumentException(prefix + "has invalid \"message\": " + messageNode.asText()); | ||
} | ||
if (StringUtils.isBlank(messageNode.asText())) { | ||
throw new IllegalArgumentException(prefix + "has empty mandatory \"message\" field."); | ||
if (message == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this not be if (messageNode.asText() == null)
? And, can it be null at all now we know messageNode
is textual?
if (!shortMessageNode.isMissingNode()) { | ||
if (!shortMessageNode.isTextual()) { | ||
throw new IllegalArgumentException(prefix + "has invalid \"short_message\": " + shortMessageNode.asText()); | ||
} | ||
if (StringUtils.isBlank(shortMessageNode.asText()) && StringUtils.isBlank(messageNode.asText())) { | ||
throw new IllegalArgumentException(prefix + "has empty mandatory \"short_message\" field."); | ||
String shortMessage = shortMessageNode.asText(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same as message
, isn't it? And, can it be null now we know that shortMessageNode
is textual?
@@ -255,19 +255,21 @@ private void validateGELFMessage(JsonNode jsonNode, UUID id, ResolvableInetSocke | |||
|
|||
final JsonNode shortMessageNode = jsonNode.path("short_message"); | |||
final JsonNode messageNode = jsonNode.path("message"); | |||
String message = shortMessageNode.asText(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line can be removed, as far as I can see.
Description
Blank log messages should not generating errors. When a client sends a blank log message it should be processed like all other messages.
Motivation and Context
Fixes #5793
Related to docker/for-linux#354 and fluent/fluentd-kubernetes-daemonset#243