-
Notifications
You must be signed in to change notification settings - Fork 34
Description
Suggestion
Add max_lines parameter used along with partial_key to limit the number of lines concatenated into a single message. Possible max_behavior parameter to indicate what to do when max is hit (truncate, new, drop).
Rationale
Sometimes messages that are broken up by Docker and reassembled by Fluentd via concat are too big for a later part of the pipeline. The reason why Docker breaks up messages is to avoid OOME. If we reconstruct the full message, it is possible for this to trigger an OOME in Fluentd, especially if there are several or many. Using max_lines to limit the total number of lines concatenated effectively acts as a truncation device on logs that exceed a certain length. In my case, messages from Docker are broken into 16k, but I emit to Kafka which we limit to 1M. With additional metadata/headers added, we need to limit the maximum number of lines to ~57 to avoid overrunning the limit on Kafka.
Example config
<filter>
@type concat
stream_identity_key docker_id
key message
partial_key partial_message
partial_value true
separator ""
flush_interval 5
max_lines 57
max_behavior truncate
</filter>