Open hectorhuertas opened 6 years ago
I'm running into the exact same issue here. Fluentd sending logs to Graylog in a Kubernetes cluster. We have a large number of Java applications that spew empty lines in their logs, just "\n" all the time.
Rignt now, I'm having a hard time configuring fluentd to ignore these.
For anyone still facing this, I managed to configure fluentd to ignore blank lines.
<filter **>
@type grep
<exclude>
key log
pattern ^\n$
</exclude>
</filter>
NOTES:
This filter must be placed before any <match>
tags.
Also, keep in mind that dockerd creates logs in the following format:
{"log":"\n","stream":"stderr","time":"2020-03-25T18:08:47.256011014Z"}
So, if you are capturing logs from a different platform, your filter may not match the same log
key from that input.
Graylog is not accepting a newline "\n" as a valid GELF short_message, throwing an error message that is not very helpful.
Expected Behavior
I would prefer graylog to accept the newline, or to throw a warning instead of an error.
Many programs (I had the issue with mongodb) log empty lines and it's hard for general log collectors to parse and filter all the possible whitespace and non-useful strings. I understand the error if the field is not set, but maybe empty strings, whitespace and the like could be a warning or info instead of an error if you don't want to accept them.
What I would really like to see is a more descriptive error message and maybe better documentation on what is not allowed in the short_message field.
Current Behavior
Trying to ingest a gelf json with
"short_message":"\n"
throws an errorThe only clue for debugging is the message
has empty mandatory "short_message" field
:I was collecting messages from a very busy fluentd instance, and it has been hard to find what kind of messages were throwing the errors, since I was looking blindly for empty strings.
Possible Solution
I have 3 suggestions:
Context
I am collecting logs from a kubernetes cluster using fluentd daemonset. I am sending the logs to graylog using https://github.com/bodhi-space/fluent-plugin-gelf-hs, which checks for the short_message being not empty, but is not parsing whitespace. I think now the plugin is doing right, since the docs doesn't specify what to check for.
Your Environment
Thank you very much!