class LogStash::Filters::Truncate

Allows you to truncate fields longer than a given length.

This truncates on bytes values, not character count. In practice, this should mean that the truncated length is somewhere between `length_bytes` and `length_bytes - 6` (UTF-8 supports up to 6-byte characters).

Public Instance Methods

filter(event) click to toggle source
# File lib/logstash/filters/truncate.rb, line 41
def filter(event)
  if @fields
    @fields.each do |field|
      Truncator.truncate(event, field, @length_bytes)
    end
  else
    Truncator.truncate_all(event, @length_bytes)
  end
  filter_matched(event)
end
register() click to toggle source
# File lib/logstash/filters/truncate.rb, line 37
def register
  # nothing
end