logstash-codec-json_lines 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash/codecs/json_lines.rb +1 -1
- data/logstash-codec-json_lines.gemspec +1 -1
- data/spec/codecs/json_lines_spec.rb +25 -0
- metadata +15 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 580c598c7d3c317608b7003fcdcb64f9121271a0
|
4
|
+
data.tar.gz: a953fb42f8e717a559a44b5cd1decab5d9e715a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9444000825f91d910bcc143d1e6da975b4ce618d83ab813a4a609c8ffffe769c8c7aa6c0fb6c4378a24cdfc31bda7f00bf8568ddda5cf68e57dba1667b93b707
|
7
|
+
data.tar.gz: eea3972e1d1435d0634b103d6a7b4fd67f52a1b40214ac1ac9ceac749579c18b2af279327aab29ea80f9b6cd6a6fc86d2ad66d7bad078944ea6207ed4230b79a
|
@@ -37,7 +37,7 @@ class LogStash::Codecs::JSONLines < LogStash::Codecs::Base
|
|
37
37
|
yield LogStash::Event.new(LogStash::Json.load(event["message"]))
|
38
38
|
rescue LogStash::Json::ParserError => e
|
39
39
|
@logger.info("JSON parse failure. Falling back to plain-text", :error => e, :data => data)
|
40
|
-
yield LogStash::Event.new("message" => event["message"], "tags" => "_jsonparsefailure")
|
40
|
+
yield LogStash::Event.new("message" => event["message"], "tags" => ["_jsonparsefailure"])
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end # def decode
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-codec-json_lines'
|
4
|
-
s.version = '0.1.
|
4
|
+
s.version = '0.1.8'
|
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"
|
@@ -58,6 +58,31 @@ describe LogStash::Codecs::JSONLines do
|
|
58
58
|
insist { decoded } == true
|
59
59
|
end
|
60
60
|
end
|
61
|
+
|
62
|
+
context "when json could not be parsed" do
|
63
|
+
|
64
|
+
let(:message) { "random_message\n" }
|
65
|
+
|
66
|
+
it "add the failure tag" do
|
67
|
+
subject.decode(message) do |event|
|
68
|
+
expect(event).to include "tags"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
it "uses an array to store the tags" do
|
73
|
+
subject.decode(message) do |event|
|
74
|
+
expect(event['tags']).to be_a Array
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
it "add a json parser failure tag" do
|
79
|
+
subject.decode(message) do |event|
|
80
|
+
expect(event['tags']).to include "_jsonparsefailure"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
61
86
|
end
|
62
87
|
|
63
88
|
context "#encode" do
|
metadata
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-codec-json_lines
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
|
14
|
+
name: logstash-core
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
17
|
- - '>='
|
17
18
|
- !ruby/object:Gem::Version
|
@@ -19,10 +20,7 @@ dependencies:
|
|
19
20
|
- - <
|
20
21
|
- !ruby/object:Gem::Version
|
21
22
|
version: 2.0.0
|
22
|
-
|
23
|
-
prerelease: false
|
24
|
-
type: :runtime
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirement: !ruby/object:Gem::Requirement
|
26
24
|
requirements:
|
27
25
|
- - '>='
|
28
26
|
- !ruby/object:Gem::Version
|
@@ -30,34 +28,36 @@ dependencies:
|
|
30
28
|
- - <
|
31
29
|
- !ruby/object:Gem::Version
|
32
30
|
version: 2.0.0
|
31
|
+
prerelease: false
|
32
|
+
type: :runtime
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
+
name: logstash-codec-line
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
34
40
|
requirement: !ruby/object:Gem::Requirement
|
35
41
|
requirements:
|
36
42
|
- - '>='
|
37
43
|
- !ruby/object:Gem::Version
|
38
44
|
version: '0'
|
39
|
-
name: logstash-codec-line
|
40
45
|
prerelease: false
|
41
46
|
type: :runtime
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: logstash-devutils
|
42
49
|
version_requirements: !ruby/object:Gem::Requirement
|
43
50
|
requirements:
|
44
51
|
- - '>='
|
45
52
|
- !ruby/object:Gem::Version
|
46
53
|
version: '0'
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
54
|
requirement: !ruby/object:Gem::Requirement
|
49
55
|
requirements:
|
50
56
|
- - '>='
|
51
57
|
- !ruby/object:Gem::Version
|
52
58
|
version: '0'
|
53
|
-
name: logstash-devutils
|
54
59
|
prerelease: false
|
55
60
|
type: :development
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - '>='
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '0'
|
61
61
|
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
|
62
62
|
email: info@elastic.co
|
63
63
|
executables: []
|