diff --git a/lib/logstash/inputs/gelf.rb b/lib/logstash/inputs/gelf.rb index 9857bba..d8b791b 100644 --- a/lib/logstash/inputs/gelf.rb +++ b/lib/logstash/inputs/gelf.rb @@ -149,9 +149,7 @@ def tcp_listener(output_queue) event = self.class.new_event(data_in, client.peeraddr[3]) next if event.nil? - remap_gelf(event) if @remap - strip_leading_underscore(event) if @strip_leading_underscore - decorate(event) + process_event(event) output_queue << event end @@ -206,9 +204,7 @@ def udp_listener(output_queue) event = self.class.new_event(data, client[3]) next if event.nil? - remap_gelf(event) if @remap - strip_leading_underscore(event) if @strip_leading_underscore - decorate(event) + process_event(event) output_queue << event end @@ -236,6 +232,12 @@ def self.new_event(json_gelf, host) event end + def process_event(event) + remap_gelf(event) if @remap + strip_leading_underscore(event) if @strip_leading_underscore + decorate(event) + end + # transform a given timestamp value into a proper LogStash::Timestamp, preserving microsecond precision # and work around a JRuby issue with Time.at loosing fractional part with BigDecimal. # @param timestamp [Numeric] a Numeric (integer, float or bigdecimal) timestampo representation