logstash-filter-json 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/logstash/filters/json.rb +5 -3
- data/logstash-filter-json.gemspec +1 -1
- data/spec/filters/json_spec.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d63e1a61fa9445004bb7885f6a538f3a2d0f111
|
4
|
+
data.tar.gz: 01e6536b5b3299872db076c92f82086214b208e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 977c862cf4042499c38c0feb4b3f3cdaca9a530b5c40d93c71513f4294c4babfe820f6ea593b66af61a46419c1858d01f3abfbce53db2563fcd9e182c4771c04
|
7
|
+
data.tar.gz: 0a699c7e3a8ec591e0c8810cb91f51e53e8ac7ae7f02ba64a995abb30e77e89d78180602f3db52fe518a4ac4d79bfc6dcaf5866de39e5259f799f149d3a3d4b4
|
data/CHANGELOG.md
CHANGED
@@ -46,7 +46,9 @@ class LogStash::Filters::Json < LogStash::Filters::Base
|
|
46
46
|
# NOTE: if the `target` field already exists, it will be overwritten!
|
47
47
|
config :target, :validate => :string
|
48
48
|
|
49
|
-
|
49
|
+
# Append values to the `tags` field when there has been no
|
50
|
+
# successful match
|
51
|
+
config :tag_on_failure, :validate => :array, :default => ["_jsonparsefailure"]
|
50
52
|
|
51
53
|
def register
|
52
54
|
# Nothing to do here
|
@@ -61,7 +63,7 @@ class LogStash::Filters::Json < LogStash::Filters::Base
|
|
61
63
|
begin
|
62
64
|
parsed = LogStash::Json.load(source)
|
63
65
|
rescue => e
|
64
|
-
event.tag(
|
66
|
+
@tag_on_failure.each{|tag| event.tag(tag)}
|
65
67
|
@logger.warn("Error parsing json", :source => @source, :raw => source, :exception => e)
|
66
68
|
return
|
67
69
|
end
|
@@ -70,7 +72,7 @@ class LogStash::Filters::Json < LogStash::Filters::Base
|
|
70
72
|
event[@target] = parsed
|
71
73
|
else
|
72
74
|
unless parsed.is_a?(Hash)
|
73
|
-
event.tag(
|
75
|
+
@tag_on_failure.each{|tag| event.tag(tag)}
|
74
76
|
@logger.warn("Parsed JSON object/hash requires a target configuration option", :source => @source, :raw => source)
|
75
77
|
return
|
76
78
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-filter-json'
|
4
|
-
s.version = '2.0.
|
4
|
+
s.version = '2.0.4'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "This is a JSON parsing filter. It takes an existing field which contains JSON and expands it into an actual data structure within the Logstash event."
|
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"
|
data/spec/filters/json_spec.rb
CHANGED
@@ -48,12 +48,14 @@ describe LogStash::Filters::Json do
|
|
48
48
|
# Parse message as JSON, store the results in the 'data' field'
|
49
49
|
source => "message"
|
50
50
|
target => "data"
|
51
|
+
tag_on_failure => ["_jsonparsefailure","_custom_failure_tag"]
|
51
52
|
}
|
52
53
|
}
|
53
54
|
CONFIG
|
54
55
|
|
55
56
|
sample "invalid json" do
|
56
57
|
insist { subject["tags"] }.include?("_jsonparsefailure")
|
58
|
+
insist { subject["tags"] }.include?("_custom_failure_tag")
|
57
59
|
end
|
58
60
|
end
|
59
61
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-core
|