Add a max-line-bytes flag which can be used to truncate messages before forwarding. #451
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We're using logstash-forwarders to forward logs from applications that we don't control. Some times, these applications may log really large lines, in which case we'd like to both keep these from being transmitted to logstash and keep the logstash-forwarder from even materializing the really long string.
This patch adds a max-line-bytes flag. max-line-bytes defaults to 0, which preserves the current behavior of logstash-forwarders: no truncation of log lines at all. When set to something greater than 0, any line containing more than max-line-bytes bytes will be truncated to max-line-bytes before being forwarded to logstash and no more than max-line-bytes is held in the harvester's buffer when reading the line.
I ran
go test
andrpsec
with the changes after runninggo build
. All tests passed except for the "packaging make rpm should build an rpm" spec, which failed with or without this patch. I've signed a elastic contributor license agreement.