Class: Fluent::Plugin::JsonSizeLimitFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/fluent/plugin/filter_jsonsizelimit.rb

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



25
26
27
28
# File 'lib/fluent/plugin/filter_jsonsizelimit.rb', line 25

def configure(conf)
  super
  log.debug "Configuring JsonSizeLimitFilter with max_size: #{@max_size}"
end

#filter(tag, time, record) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/fluent/plugin/filter_jsonsizelimit.rb', line 30

def filter(tag, time, record)
  original_size = record.to_json.bytesize
  reduce_size(record, @max_size)
  final_size = record.to_json.bytesize

  log.debug "Reduced record size from #{original_size} to #{final_size} bytes" if original_size != final_size
  record
end