lib/logstash/inputs/gelf.rb in logstash-input-gelf-3.3.1 vs lib/logstash/inputs/gelf.rb in logstash-input-gelf-3.3.2
- old
+ new
@@ -241,10 +241,12 @@
# @param timestamp [Numeric] a Numeric (integer, float or bigdecimal) timestampo representation
# @return [LogStash::Timestamp] the proper LogStash::Timestamp representation
def self.coerce_timestamp(timestamp)
# prevent artificial precision from being injected by floats
timestamp = timestamp.rationalize if timestamp.kind_of?(Float)
- LogStash::Timestamp.at(timestamp)
+
+ # bug in JRuby prevents correcly parsing a BigDecimal fractional part, see https://github.com/elastic/logstash/issues/4565
+ timestamp.is_a?(BigDecimal) ? LogStash::Timestamp.at(timestamp.to_i, timestamp.frac * 1000000) : LogStash::Timestamp.at(timestamp)
end
def self.parse(json)
o = LogStash::Json.load(json)
LogStash::Event.new(o)