logstash-input-gelf 3.3.1 → 3.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4b681e1769e452f4699058f8663137c81fe50e2ce19f1f8ec130964125bade1
4
- data.tar.gz: 70f5a59240931cfcac843db52e275cbe97a2e624c59c59e9162fe6a34251f8db
3
+ metadata.gz: dbaa212dd64992aea162a2d0888468f52e91b9a251fcbd7eb3d02850b82da24a
4
+ data.tar.gz: 804762f84e844e55ed7efb4bb9dd02a4d0e7a6a56f5c2ea8fea0e5945a2683c2
5
5
  SHA512:
6
- metadata.gz: a602e5bea3c91f985e72b49780241696da85f7eb210c2028396edf328a0214de738001e476f0f763dcc06aa4a6d5224e98a0003411d56480fb60bf8e92bf6b10
7
- data.tar.gz: 43b6c5cf39ef80374b75272431c50e5a16facc67300a753523ede5ed5b78d1c05103405cd8a4ca898e0e474835b946554ca7856239095bd65c38087bc912757e
6
+ metadata.gz: 49f13ce13d7acdd4862f4db62f31dfbeea263013d201cf9e761c6f76f1621f06dee7206c39b8e991f06b0150377d10f24d2b955787ae02c49b8eced72541be4e
7
+ data.tar.gz: 1b7eb70bd7eb91728f9feb23d937c62cd896a9c12b1aa575950aa2e87cdcaffbacd90949dcd3799230650691d846b82165101e98c1e9176008a71d72ae303bc0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 3.3.2
2
+ - Fix: avoid panic when handling very-large exponent-notation `_@timestamp` values [#71](https://github.com/logstash-plugins/logstash-input-gelf/pull/71)
3
+
1
4
  ## 3.3.1
2
5
  - Fix: safely coerce the value of `_@timestamp` to avoid crashing the plugin [#67](https://github.com/logstash-plugins/logstash-input-gelf/pull/67)
3
6
 
@@ -243,7 +243,9 @@ class LogStash::Inputs::Gelf < LogStash::Inputs::Base
243
243
  def self.coerce_timestamp(timestamp)
244
244
  # prevent artificial precision from being injected by floats
245
245
  timestamp = timestamp.rationalize if timestamp.kind_of?(Float)
246
- LogStash::Timestamp.at(timestamp)
246
+
247
+ # bug in JRuby prevents correcly parsing a BigDecimal fractional part, see https://github.com/elastic/logstash/issues/4565
248
+ timestamp.is_a?(BigDecimal) ? LogStash::Timestamp.at(timestamp.to_i, timestamp.frac * 1000000) : LogStash::Timestamp.at(timestamp)
247
249
  end
248
250
 
249
251
  def self.parse(json)
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-gelf'
4
- s.version = '3.3.1'
4
+ s.version = '3.3.2'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Reads GELF-format messages from Graylog2 as events"
7
7
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -176,9 +176,9 @@ describe LogStash::Inputs::Gelf do
176
176
 
177
177
  context "BigDecimal numeric values" do
178
178
  it "should coerce and preserve millisec precision in iso8601" do
179
- expect(LogStash::Inputs::Gelf.coerce_timestamp(BigDecimal.new("946702800.1")).to_iso8601).to eq("2000-01-01T05:00:00.100Z")
180
- expect(LogStash::Inputs::Gelf.coerce_timestamp(BigDecimal.new("946702800.12")).to_iso8601).to eq("2000-01-01T05:00:00.120Z")
181
- expect(LogStash::Inputs::Gelf.coerce_timestamp(BigDecimal.new("946702800.123")).to_iso8601).to eq("2000-01-01T05:00:00.123Z")
179
+ expect(LogStash::Inputs::Gelf.coerce_timestamp(BigDecimal.new("946702800.1"))).to be_a_logstash_timestamp_equivalent_to("2000-01-01T05:00:00.100Z")
180
+ expect(LogStash::Inputs::Gelf.coerce_timestamp(BigDecimal.new("946702800.12"))).to be_a_logstash_timestamp_equivalent_to("2000-01-01T05:00:00.120Z")
181
+ expect(LogStash::Inputs::Gelf.coerce_timestamp(BigDecimal.new("946702800.123"))).to be_a_logstash_timestamp_equivalent_to("2000-01-01T05:00:00.123Z")
182
182
  end
183
183
 
184
184
  it "should coerce and preserve usec precision" do
@@ -206,7 +206,12 @@ describe LogStash::Inputs::Gelf do
206
206
 
207
207
  it "should coerce float numeric value and preserve milliseconds precision in iso8601" do
208
208
  event = LogStash::Inputs::Gelf.new_event("{\"timestamp\":946702800.123}", "dummy")
209
- expect(event.timestamp.to_iso8601).to eq("2000-01-01T05:00:00.123Z")
209
+ expect(event.timestamp).to be_a_logstash_timestamp_equivalent_to("2000-01-01T05:00:00.123Z")
210
+ end
211
+
212
+ it "should coerce exponent-notation timestamps" do
213
+ event = LogStash::Inputs::Gelf.new_event("{\"timestamp\":1.660873462488E13}", "dummy")
214
+ expect(event.timestamp).to be_a_logstash_timestamp_equivalent_to("+528279-11-06T19:48:00Z")
210
215
  end
211
216
 
212
217
  it "should coerce float numeric value and preserve usec precision" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-gelf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.1
4
+ version: 3.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-21 00:00:00.000000000 Z
11
+ date: 2022-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement