lib/fluent/plugin/gelf_plugin_util.rb in fluent-plugin-gelf-best-1.3.3 vs lib/fluent/plugin/gelf_plugin_util.rb in fluent-plugin-gelf-best-1.3.4
- old
+ new
@@ -34,9 +34,12 @@
time
end
end
def process_record_entry(k, v, conf, gelfentry)
+ # Truncate values longer than max_bytes
+ v = (v.respond_to?(:bytesize) && v.bytesize > conf[:max_bytes]) ? "#{v.byteslice(0, conf[:max_bytes] - 3)}..." : v
+
case k
when 'host', 'hostname'
return {'host' => (conf[:use_record_host] ? v : gelfentry['_host'] = v)}
when 'timestamp', 'time'
{ 'timestamp' => parse_timestamp(v) }