logstash-filter-exceptioncategory 0.1.80 → 0.1.81

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: f381ef71cf82f1218c2d2d55ccab26599ef8c8e0
4
- data.tar.gz: 3f6496b8bc91b32bd4688f7627197024f79f880a
3
+ metadata.gz: bf34c605404d90e050810ca83a39a9168a2f4533
4
+ data.tar.gz: eae66403351bba052b0df369434c004d1993ffa3
5
5
  SHA512:
6
- metadata.gz: 7984570789912eb9ba02a2b4163420fbbab670fc3703860a8fa51824a710fa409d9d0317147a778b7a37d5e13f16dac94de8d222479b225ca3bd7ec8df7fc087
7
- data.tar.gz: 54405169c8266988c72f8c949a49b5be366c2f5b73db8ddb20f95525b9196ac810603fa2870bf8feaed109a1d02a7bb92dcc11268a0a4712db4b37345840eb8a
6
+ metadata.gz: 7617f6be5a81279fd38477ee399082186d17698916bf93088f9f0fcb283e13c8dc3f7ee16768e62f90eccae5e3cd79cb463bb62df94add6952f2689388ad2d35
7
+ data.tar.gz: 7d66d5bee648f1bacb6c0ce1039d679c01060fbf72e1073286be90a68d1a146f5fc3f8e02629fef4024c1d851b8b8d0140ed59eb4058afbf22a95bf0bae6a916
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
- source 'https://rubygems.org'
1
+ source 'https://rubygems.org'
2
2
  gemspec
data/LICENSE CHANGED
@@ -1,13 +1,13 @@
1
- Copyright [yyyy] [author]
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
1
+ Copyright [yyyy] [author]
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
13
  limitations under the License.
data/README.md CHANGED
@@ -1,27 +1,27 @@
1
- # ExceptionsCategory
2
-
3
- This Logstash filter sends an html request for a json document.
4
- It then looks up the @Exception attached to the event and tries to match that to a category from the json document.
5
- If it fails to do so, it looks up the Title attached to the event and tries the same thing with the Title.
6
-
7
- If neither of those attributes are attached to the event, or if neither of them are present in the json document, it attached a _None_ category to the event.
8
-
9
- Usage:
10
- ```
11
- filter {
12
- exceptionscategory {
13
- category_url => "url/to/json"
14
- }
15
- }
16
- ```
17
- Where _category_url_ is a required parameter, pointing to the url of the json document.
18
-
19
- The json document must be structured as follows:
20
- ```json
21
- {
22
- "Exceptions": {
23
- "BadException": "Severe",
24
- "GoodException": "Warning"
25
- }
26
- }
1
+ # ExceptionsCategory
2
+
3
+ This Logstash filter sends an html request for a json document.
4
+ It then looks up the @Exception attached to the event and tries to match that to a category from the json document.
5
+ If it fails to do so, it looks up the Title attached to the event and tries the same thing with the Title.
6
+
7
+ If neither of those attributes are attached to the event, or if neither of them are present in the json document, it attached a _None_ category to the event.
8
+
9
+ Usage:
10
+ ```
11
+ filter {
12
+ exceptionscategory {
13
+ category_url => "url/to/json"
14
+ }
15
+ }
16
+ ```
17
+ Where _category_url_ is a required parameter, pointing to the url of the json document.
18
+
19
+ The json document must be structured as follows:
20
+ ```json
21
+ {
22
+ "Exceptions": {
23
+ "BadException": "Severe",
24
+ "GoodException": "Warning"
25
+ }
26
+ }
27
27
  ```
@@ -1,56 +1,60 @@
1
- # encoding: utf-8
2
- require 'logstash/filters/base'
3
- require 'logstash/namespace'
4
- require 'net/http'
5
- require 'json'
6
-
7
- class LogStash::Filters::ExceptionCategory < LogStash::Filters::Base
8
-
9
- config_name "exceptioncategory"
10
-
11
- config :category_url, :validate => :string, :required => true
12
-
13
- public
14
- def register
15
- uri = URI(@category_url)
16
- response = Net::HTTP.get(uri)
17
- begin
18
- @Exceptions = JSON.parse(response)
19
- rescue JSON::ParserError => e
20
- @logger.error("The URL does not respond with a valid JSON object", :exception => e)
21
- raise e
22
- end
23
-
24
- checkJSON()
25
- end # def register
26
-
27
- public
28
- def filter(event)
29
- categories = @Exceptions["Exceptions"]
30
-
31
- unless event["SagaException"].nil?
32
- event_exception = event["SagaException_Exception_ExceptionType"]
33
- end
34
-
35
- unless categories.key?(event_exception)
36
- event_exception = event["Title"]
37
- end
38
-
39
- event_exception && category = categories[event_exception]
40
- event["@Category"] = (category ? category : "None")
41
-
42
- filter_matched(event)
43
- end #def filter
44
-
45
- def checkJSON()
46
- unless @Exceptions["Exceptions"]
47
- @logger.error("JSON Object does not contain Exceptions field")
48
- raise "Malformed JSON"
49
- end
50
-
51
- unless @Exceptions["Exceptions"].respond_to?(:has_key?)
52
- @logger.error("Malformed JSON Object, Exceptions should include a JSON object, not an array")
53
- raise "Malformed JSON"
54
- end
55
- end #def checkJSON
1
+ # encoding: utf-8
2
+ require 'logstash/filters/base'
3
+ require 'logstash/namespace'
4
+ require 'net/http'
5
+ require 'json'
6
+
7
+ class LogStash::Filters::ExceptionCategory < LogStash::Filters::Base
8
+
9
+ config_name "exceptioncategory"
10
+
11
+ config :category_url, :validate => :string, :required => true
12
+
13
+ public
14
+ def register
15
+ uri = URI(@category_url)
16
+ response = Net::HTTP.get(uri)
17
+ begin
18
+ @Exceptions = JSON.parse(response)
19
+ rescue JSON::ParserError => e
20
+ @logger.error("The URL does not respond with a valid JSON object", :exception => e)
21
+ raise e
22
+ end
23
+
24
+ checkJSON()
25
+ end # def register
26
+
27
+ public
28
+ def filter(event)
29
+ categories = @Exceptions["Exceptions"]
30
+
31
+
32
+
33
+ unless event["SagaException"].nil?
34
+ event_exception = event["SagaException"]["Exception"]["ExceptionType"]
35
+ else
36
+ event_exception = event["SagaException_Exception_ExceptionType"]
37
+ end
38
+
39
+ unless categories.key?(event_exception)
40
+ event_exception = event["Title"]
41
+ end
42
+
43
+ event_exception && category = categories[event_exception]
44
+ event["@Category"] = (category ? category : "None")
45
+
46
+ filter_matched(event)
47
+ end #def filter
48
+
49
+ def checkJSON()
50
+ unless @Exceptions["Exceptions"]
51
+ @logger.error("JSON Object does not contain Exceptions field")
52
+ raise "Malformed JSON"
53
+ end
54
+
55
+ unless @Exceptions["Exceptions"].respond_to?(:has_key?)
56
+ @logger.error("Malformed JSON Object, Exceptions should include a JSON object, not an array")
57
+ raise "Malformed JSON"
58
+ end
59
+ end #def checkJSON
56
60
  end # LogStash::Filters::Example
@@ -1,20 +1,20 @@
1
- # encoding: utf-8
2
-
3
- Gem::Specification.new do |s|
4
- s.name = 'logstash-filter-exceptioncategory'
5
- s.version = '0.1.80'
6
- s.licenses = ['Apache-2.0']
7
- s.summary = "Categorizes exceptions"
8
- s.description = "Fetches a remote json file which includes categorization of exceptions. Uses that categorization to attach a category to an event depending on which exception the event has."
9
- s.authors = ['Ragnar Adolf Árnason']
10
- s.email = "ragnara@tmsoftware.is"
11
- s.homepage = "http://www.tmsoftware.is"
12
- s.require_paths = ["lib"]
13
-
14
- s.files = Dir['lib/**/*', 'spec/**/*', '*.gemspec', '*.md', 'Gemfile', 'LICENSE']
15
-
16
- s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
17
-
18
- s.add_runtime_dependency "logstash-core-plugin-api", "~> 1.0"
19
- s.add_development_dependency "logstash-devutils", "~> 0"
1
+ # encoding: utf-8
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'logstash-filter-exceptioncategory'
5
+ s.version = '0.1.81'
6
+ s.licenses = ['Apache-2.0']
7
+ s.summary = "Categorizes exceptions"
8
+ s.description = "Fetches a remote json file which includes categorization of exceptions. Uses that categorization to attach a category to an event depending on which exception the event has."
9
+ s.authors = ['Ragnar Adolf Árnason']
10
+ s.email = "ragnara@tmsoftware.is"
11
+ s.homepage = "http://www.tmsoftware.is"
12
+ s.require_paths = ["lib"]
13
+
14
+ s.files = Dir['lib/**/*', 'spec/**/*', '*.gemspec', '*.md', 'Gemfile', 'LICENSE']
15
+
16
+ s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
17
+
18
+ s.add_runtime_dependency "logstash-core-plugin-api", "~> 1.0"
19
+ s.add_development_dependency "logstash-devutils", "~> 0"
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-exceptioncategory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.80
4
+ version: 0.1.81
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ragnar Adolf Árnason
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-21 00:00:00.000000000 Z
11
+ date: 2016-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement