fluent-plugin-input-jsonstream 0.1.0 → 0.1.1

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: dc06d04f6fe9640b488591223d11a19e60f45fb6
4
- data.tar.gz: 482a366b30a2733483820c944994b6812e72f498
3
+ metadata.gz: d5793b9090d40e7fc7da768efcbc0a934c71830e
4
+ data.tar.gz: b08f3dc690ed55d0fba13c27442d21148df36c7f
5
5
  SHA512:
6
- metadata.gz: 87bf0305b59d703578b6fb931d1b0299c57b8135c7f216600a96c959f467d7ed31b16fdbb28b9edaeccc47d7a55835620d38833566673bf804933835e0604b44
7
- data.tar.gz: fdd242be75c8b5ee16de7eb827ed5d97a813ab10115914a002e4c640b428226fb189c9d0ede4b173ad8f97a776e51d6bfd0dec62d2c36fbd04e613cd595f0065
6
+ metadata.gz: f10fa53ebdc42fc460c4432f58e7d9f718405bafefb2372facd71bb3601f15d91324c51fa1c04375c1d2eb140568701743ccdf4fc5bd2a8d19f43b1cdc5e837a
7
+ data.tar.gz: cf5b3aac7e23b59528d11c0dbf0413a9fd94023773091eadfad459d4794cba7682f300205af6c5dc28f2af5a024e4e3e6a00260162a94230b394001eedb4ba52
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
7
7
  gem.license = "MIT"
8
8
  gem.homepage = "https://github.com/MerlinDMC/fluent-plugin-input-jsonstream"
9
9
  gem.summary = gem.description
10
- gem.version = "0.1.0"
10
+ gem.version = "0.1.1"
11
11
  gem.authors = ["Daniel Malon"]
12
12
  gem.email = "daniel.malon@me.com"
13
13
  gem.has_rdoc = false
@@ -32,22 +32,32 @@ module Fluent::Plugin
32
32
  super
33
33
 
34
34
  server_create_connection(:in_jsonstream_server, @port, bind: @bind) do |conn|
35
- parser = Yajl::Parser.new(:symbolize_keys => false)
36
- parser.on_parse_complete = lambda { |record|
37
- tag = extract_tag_from_record(record)
38
- tag ||= @tag
39
- time ||= extract_time_from_record(record) || Fluent::EventTime.now
40
-
41
- # Use the recorded event time if available
42
- time = record.delete('timestamp').to_i if record.key?('timestamp')
43
-
44
- router.emit(tag, time, record)
45
- }
46
-
35
+ parser = newParser()
47
36
  conn.data do |data|
48
- parser << data
37
+ begin
38
+ parser << data
39
+ rescue Yajl::ParseError
40
+ parser = newParser()
41
+ end
49
42
  end
50
43
  end
51
44
  end
45
+
46
+ private
47
+
48
+ def newParser
49
+ parser = Yajl::Parser.new(:symbolize_keys => false)
50
+ parser.on_parse_complete = lambda { |record|
51
+ tag = extract_tag_from_record(record)
52
+ tag ||= @tag
53
+ time ||= extract_time_from_record(record) || Fluent::EventTime.now
54
+
55
+ # Use the recorded event time if available
56
+ time = record.delete('timestamp').to_i if record.key?('timestamp')
57
+
58
+ router.emit(tag, time, record)
59
+ }
60
+ parser
61
+ end
52
62
  end
53
63
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-input-jsonstream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Malon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-12 00:00:00.000000000 Z
11
+ date: 2017-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  requirements: []
118
118
  rubyforge_project:
119
- rubygems_version: 2.6.8
119
+ rubygems_version: 2.6.11
120
120
  signing_key:
121
121
  specification_version: 4
122
122
  summary: A streaming JSON input plugin for fluentd