logstash-codec-json_lines 3.0.5 → 3.0.6

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: 2c6b63f3d0477d5d4cd13473d2f71d4c807720dd3c7bd413ec9e2086af855c27
4
- data.tar.gz: 8e71437c1f8162d45a8209c6b9c4aa4659ae4f054725395fe0dd16db69a09127
3
+ metadata.gz: edbff14bdc579c0b6c6f7f607ef8e81873e2ea8c9404a15310cf8c8129b3c22d
4
+ data.tar.gz: cf3e588e9db2101e137787f18e6254450cf20bdb60e9af852241c2893f290c33
5
5
  SHA512:
6
- metadata.gz: a8f96aaf3289f31e3414ff8d3d7bd19dbf309655b6c79940ae9d76e8e046f7809dd64975f88aad1fd0d6d59814593667df79dd52c9ea32c7ccccf701bacd5265
7
- data.tar.gz: 5e37cbe8765a7600f0830f9aa9b2e476d69c77c2c1cc1c44918dec3e8897505d2a106ed8577d3b6f52ca181831c78a43b92967c1f13a63b4970f21ed922ea267
6
+ metadata.gz: d70360d5ab80210d388c3ae0b7c55fb869565b565e4fc32859624f4325dfaaf03d589ed1e5201d2a7e712df56e2a86b8e20f19bb324f7974872e75848b606dbc
7
+ data.tar.gz: 321f6af47b9ccadaa216dc1d1473f286266758434b9b3368f914688231995de27961366590aa0bf335c2d830aa51f0b43c71c81b85caf8a0cb6123e34fbcac45
@@ -1,3 +1,6 @@
1
+ ## 3.0.6
2
+ - Support flush method, see https://github.com/logstash-plugins/logstash-codec-json_lines/pull/35
3
+
1
4
  ## 3.0.5
2
5
  - Update gemspec summary
3
6
 
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012–2016 Elasticsearch <http://www.elastic.co>
1
+ Copyright (c) 2012-2018 Elasticsearch <http://www.elastic.co>
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
@@ -48,6 +48,13 @@ class LogStash::Codecs::JSONLines < LogStash::Codecs::Base
48
48
  @on_event.call(event, "#{event.to_json}#{@delimiter}")
49
49
  end
50
50
 
51
+ def flush(&block)
52
+ remainder = @buffer.flush
53
+ if !remainder.empty?
54
+ parse(@converter.convert(remainder), &block)
55
+ end
56
+ end
57
+
51
58
  private
52
59
 
53
60
  # from_json_parse uses the Event#from_json method to deserialize and directly produce events
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-codec-json_lines'
4
- s.version = '3.0.5'
4
+ s.version = '3.0.6'
5
5
  s.licenses = ['Apache License (2.0)']
6
- s.summary = "Reads newline-delimited JSON"
6
+ s.summary = "Reads and writes newline-delimited JSON"
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"
8
8
  s.authors = ["Elastic"]
9
9
  s.email = 'info@elastic.co'
@@ -214,5 +214,24 @@ describe LogStash::Codecs::JSONLines do
214
214
  LogStash::Codecs::JSONLines.new(codec_options)
215
215
  end
216
216
  end
217
+
218
+ context "flush" do
219
+ subject do
220
+ LogStash::Codecs::JSONLines.new(codec_options)
221
+ end
222
+
223
+ let(:input) { "{\"foo\":\"bar\"}" }
224
+
225
+ it "should flush buffered data'" do
226
+ result = []
227
+ subject.decode(input) { |e| result << e }
228
+ expect(result.size).to eq(0)
229
+
230
+ subject.flush { |e| result << e }
231
+ expect(result.size).to eq(1)
232
+
233
+ expect(result[0].get("foo")).to eq("bar")
234
+ end
235
+ end
217
236
  end
218
237
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-codec-json_lines
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.5
4
+ version: 3.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-07 00:00:00.000000000 Z
11
+ date: 2018-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -98,9 +98,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  requirements: []
100
100
  rubyforge_project:
101
- rubygems_version: 2.6.11
101
+ rubygems_version: 2.6.13
102
102
  signing_key:
103
103
  specification_version: 4
104
- summary: Reads newline-delimited JSON
104
+ summary: Reads and writes newline-delimited JSON
105
105
  test_files:
106
106
  - spec/codecs/json_lines_spec.rb