logstash-codec-json_lines 2.0.4 → 2.0.5

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
  SHA1:
3
- metadata.gz: 8f521208069a7cd36106fb98b084d514e09ee87f
4
- data.tar.gz: 4be461209d267a74a8ba35904f6f819493c8c466
3
+ metadata.gz: 313c69ada5cae85d4921a4bb4d40966784a34eb4
4
+ data.tar.gz: f6e4543df04605d602fd8df5bb296877ca792e43
5
5
  SHA512:
6
- metadata.gz: 97921e4feed4e57da139aa12b6a29d00f0430ecf19bf6b4c94fd46ca03db3c1c5430b63a26b22de5b83c47eca4d81749232bad2675e6e4a84d026385f612f41f
7
- data.tar.gz: bd9480c4584eb40ea9b1218821cf53ac6de56e61f50c47a158476353300239d89280292f4cac31f21c3e4e0ade204c363d15e8e3ecaca3fa2915493c326d9512
6
+ metadata.gz: 9c6cfe1bbd4c7683077f2f8819211a0a9c78ae2a16e43d787c3155dd3ab8a9c6ca6f7b8c280d5f67159c73b3553590fbc47ca03b4c91d91c083370aab7021ce8
7
+ data.tar.gz: 3aaa57ac5fa0adff86f2c1eeaef369904f7932eb16704c66d3da4563c3d0bb532c00be38c9fe6374826038acba83c19e40d482d0b20270b687e2f8e359019d1c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 2.0.5
2
+ - Directly use buftok to avoid indirection through the line codec https://github.com/logstash-plugins/logstash-codec-json_lines/pull/18
3
+
1
4
  ## 2.0.4
2
5
  - Support for customizable delimiter
3
6
 
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
  require "logstash/codecs/base"
3
- require "logstash/codecs/line"
3
+ require "logstash/util/charset"
4
+ require "logstash/util/buftok"
4
5
  require "logstash/json"
5
6
 
6
7
  # This codec will decode streamed JSON that is newline delimited.
@@ -13,7 +14,6 @@ require "logstash/json"
13
14
  class LogStash::Codecs::JSONLines < LogStash::Codecs::Base
14
15
  config_name "json_lines"
15
16
 
16
-
17
17
  # The character encoding used in this codec. Examples include `UTF-8` and
18
18
  # `CP1252`
19
19
  #
@@ -30,15 +30,15 @@ class LogStash::Codecs::JSONLines < LogStash::Codecs::Base
30
30
 
31
31
  public
32
32
 
33
- def initialize(params={})
34
- super(params)
35
- @lines = LogStash::Codecs::Line.new("delimiter" => @delimiter)
36
- @lines.charset = @charset
33
+ def register
34
+ @buffer = FileWatch::BufferedTokenizer.new(@delimiter)
35
+ @converter = LogStash::Util::Charset.new(@charset)
36
+ @converter.logger = @logger
37
37
  end
38
38
 
39
39
  def decode(data)
40
- @lines.decode(data) do |event|
41
- yield guard(event, data)
40
+ @buffer.extract(data).each do |line|
41
+ yield guard(@converter.convert(line))
42
42
  end
43
43
  end # def decode
44
44
 
@@ -50,11 +50,11 @@ class LogStash::Codecs::JSONLines < LogStash::Codecs::Base
50
50
 
51
51
  private
52
52
 
53
- def guard(event, data)
53
+ def guard(data)
54
54
  begin
55
- LogStash::Event.new(LogStash::Json.load(event["message"]))
55
+ LogStash::Event.new(LogStash::Json.load(data))
56
56
  rescue LogStash::Json::ParserError => e
57
- LogStash::Event.new("message" => event["message"], "tags" => ["_jsonparsefailure"])
57
+ LogStash::Event.new("message" => data, "tags" => ["_jsonparsefailure"])
58
58
  end
59
59
  end
60
60
 
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-codec-json_lines'
4
- s.version = '2.0.4'
4
+ s.version = '2.0.5'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "This codec will decode streamed JSON that is newline delimited."
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/plugin install gemname. This gem is not a stand-alone program"
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.require_paths = ["lib"]
12
12
 
13
13
  # Files
14
- s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
14
+ s.files = Dir['lib/**/*','spec/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
15
15
 
16
16
  # Tests
17
17
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require "logstash/codecs/json_lines"
2
4
  require "logstash/event"
3
5
  require "logstash/json"
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: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-29 00:00:00.000000000 Z
11
+ date: 2016-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-core