logstash-filter-schema_validation 0.2.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +6 -0
  3. data/CONTRIBUTORS +11 -0
  4. data/DEVELOPER.md +2 -0
  5. data/Gemfile +12 -0
  6. data/LICENSE +11 -0
  7. data/README.md +95 -0
  8. data/VERSION +1 -0
  9. data/lib/logstash-filter-schema_validation.rb +13 -0
  10. data/lib/logstash/filters/schema_validation.rb +109 -0
  11. data/logstash-filter-schema_validation.gemspec +26 -0
  12. data/spec/filters/schema-validator_spec.rb +111 -0
  13. data/spec/pipelines/test.conf +31 -0
  14. data/spec/schemas/http.json +68 -0
  15. data/spec/schemas/simple.json +17 -0
  16. data/spec/schemas/simple0.json +22 -0
  17. data/spec/schemas/simple_strict.json +18 -0
  18. data/spec/schemas/wrong.json +14 -0
  19. data/spec/spec_helper.rb +2 -0
  20. data/vendor/jar-dependencies/com/github/everit-org/json-schema/org.everit.json.schema/1.8.0/org.everit.json.schema-1.8.0.jar +0 -0
  21. data/vendor/jar-dependencies/com/github/fge/btf/1.2/btf-1.2.jar +0 -0
  22. data/vendor/jar-dependencies/com/github/fge/msg-simple/1.1/msg-simple-1.1.jar +0 -0
  23. data/vendor/jar-dependencies/com/github/fge/uri-template/0.9/uri-template-0.9.jar +0 -0
  24. data/vendor/jar-dependencies/com/github/java-json-tools/jackson-coreutils/1.9/jackson-coreutils-1.9.jar +0 -0
  25. data/vendor/jar-dependencies/com/github/java-json-tools/json-schema-core/1.2.10/json-schema-core-1.2.10.jar +0 -0
  26. data/vendor/jar-dependencies/com/github/java-json-tools/json-schema-validator/2.2.10/json-schema-validator-2.2.10.jar +0 -0
  27. data/vendor/jar-dependencies/com/google/guava/guava/16.0.1/guava-16.0.1.jar +0 -0
  28. data/vendor/jar-dependencies/com/googlecode/libphonenumber/libphonenumber/8.0.0/libphonenumber-8.0.0.jar +0 -0
  29. data/vendor/jar-dependencies/io/netty/netty-all/4.1.18.Final/netty-all-4.1.18.Final.jar +0 -0
  30. data/vendor/jar-dependencies/io/netty/netty-tcnative-boringssl-static/2.0.7.Final/netty-tcnative-boringssl-static-2.0.7.Final.jar +0 -0
  31. data/vendor/jar-dependencies/javax/mail/javax.mail-api/1.5.1/javax.mail-api-1.5.1.jar +0 -0
  32. data/vendor/jar-dependencies/org/apache/logging/log4j/log4j-api/2.6.2/log4j-api-2.6.2.jar +0 -0
  33. data/vendor/jar-dependencies/org/logstash/plugins/input/http/logstash-filter-schema_validation/0.2.0/logstash-filter-schema_validation-0.2.0.jar +0 -0
  34. metadata +134 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f8b82ec4a6c7e5acdb1aac93e4c002f417076c7c
4
+ data.tar.gz: 6c581c65c18d9c545917c3100610ec491e370144
5
+ SHA512:
6
+ metadata.gz: bb8fb2ec85db1fb888d786e0e529ed7312dfe5cc02bedaad663b79b64b712ae0b986ffab80a43bbfef1c4d10f8b4ddc01ed896e4a814ddad40a9e25dad0d05ba
7
+ data.tar.gz: a20c5f125bdaede1159e08c6d4b527f1d333d273aa7f75251ddc5dbe3f65bd0d644f2fa23eeb06b6b336750a39e4333d07e7782fd7abeaf3133aba067e405178
data/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ ## 0.1.0
2
+ - Add spec tests
3
+ - Refactor docker-compose stuff
4
+
5
+ ## 0.1.0
6
+ - Plugin created with the logstash plugin generator
data/CONTRIBUTORS ADDED
@@ -0,0 +1,11 @@
1
+ The following is a list of people who have contributed ideas, code, bug
2
+ reports, or in general have helped logstash along its way.
3
+
4
+ Contributors:
5
+ * Thomas Decaux @Qwant
6
+ * Carlo Dosso @SubitoLabs
7
+
8
+ Note: If you've sent us patches, bug reports, or otherwise contributed to
9
+ Logstash, and you aren't on the list above and want to be, please let us know
10
+ and we'll make sure you're here. Contributions from folks like you are what make
11
+ open source awesome.
data/DEVELOPER.md ADDED
@@ -0,0 +1,2 @@
1
+ # logstash-filter-schema-validator
2
+ Example filter plugin. This should help bootstrap your effort to write your own filter plugin!
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+
4
+ logstash_path = ENV["LOGSTASH_PATH"] || "../../logstash"
5
+ use_logstash_source = ENV["LOGSTASH_SOURCE"] && ENV["LOGSTASH_SOURCE"].to_s == "1"
6
+
7
+ if Dir.exist?(logstash_path) && use_logstash_source
8
+ gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
9
+ gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
10
+ else
11
+ gem 'logstash-core', :github => "elastic/logstash", :branch => "6.2"
12
+ end
data/LICENSE ADDED
@@ -0,0 +1,11 @@
1
+ Licensed under the Apache License, Version 2.0 (the "License");
2
+ you may not use this file except in compliance with the License.
3
+ You may obtain a copy of the License at
4
+
5
+ http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,95 @@
1
+ [![Build Status](https://travis-ci.org/ebuildy/logstash-filter-schema_validation.svg?branch=master)](https://travis-ci.org/ebuildy/logstash-filter-schema_validation)
2
+
3
+ https://rubygems.org/gems/logstash-filter-schema_validation
4
+
5
+ ## Installation
6
+
7
+ ``logstash-plugin install logstash-filter-schema_validation``
8
+
9
+
10
+ # Logstash Plugin
11
+
12
+ This is a plugin for [Logstash](https://github.com/elastic/logstash).
13
+
14
+ It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
15
+
16
+ ## Documentation
17
+
18
+ Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elastic.co/guide/en/logstash/current/).
19
+
20
+ - For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
21
+ - For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
22
+
23
+ ## Need Help?
24
+
25
+ Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
26
+
27
+ ## Developing
28
+
29
+ ### 1. Plugin Developement and Testing
30
+
31
+ #### Code
32
+ - To get started, you'll need JRuby with the Bundler gem installed.
33
+
34
+ - Create a new plugin or clone and existing from the GitHub [logstash-plugins](https://github.com/logstash-plugins) organization. We also provide [example plugins](https://github.com/logstash-plugins?query=example).
35
+
36
+ - Install dependencies
37
+ ```sh
38
+ bundle install
39
+ ```
40
+
41
+ #### Test
42
+
43
+ - Update your dependencies
44
+
45
+ ```sh
46
+ bundle install
47
+ ```
48
+
49
+ - Run tests
50
+
51
+ ```sh
52
+ bundle exec rspec
53
+ ```
54
+
55
+ ### 2. Running your unpublished Plugin in Logstash
56
+
57
+ #### 2.1 Run in a local Logstash clone
58
+
59
+ - Edit Logstash `Gemfile` and add the local plugin path, for example:
60
+ ```ruby
61
+ gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
62
+ ```
63
+ - Install plugin
64
+ ```sh
65
+ bin/logstash-plugin install --no-verify
66
+ ```
67
+ - Run Logstash with your plugin
68
+ ```sh
69
+ bin/logstash -e 'filter {awesome {}}'
70
+ ```
71
+ At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
72
+
73
+ #### 2.2 Run in an installed Logstash
74
+
75
+ You can use the same **2.1** method to run your plugin in an installed Logstash by editing its `Gemfile` and pointing the `:path` to your local plugin development directory or you can build the gem and install it using:
76
+
77
+ - Build your plugin gem
78
+ ```sh
79
+ gem build logstash-filter-awesome.gemspec
80
+ ```
81
+ - Install the plugin from the Logstash home
82
+ ```sh
83
+ bin/logstash-plugin install /your/local/plugin/logstash-filter-awesome.gem
84
+ ```
85
+ - Start Logstash and proceed to test the plugin
86
+
87
+ ## Contributing
88
+
89
+ All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
90
+
91
+ Programming is not a required skill. Whatever you've seen about open source and maintainers or community members saying "send patches or die" - you will not see that here.
92
+
93
+ It is more important to the community that you are able to contribute.
94
+
95
+ For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.0
@@ -0,0 +1,13 @@
1
+ # AUTOGENERATED BY THE GRADLE SCRIPT. DO NOT EDIT.
2
+
3
+ require 'jar_dependencies'
4
+ require_jar('javax.mail', 'javax.mail-api', '1.5.1')
5
+ require_jar('com.google.guava', 'guava', '16.0.1')
6
+ require_jar('com.googlecode.libphonenumber', 'libphonenumber', '8.0.0')
7
+ require_jar('com.github.fge', 'msg-simple', '1.1')
8
+ require_jar('com.github.fge', 'btf', '1.2')
9
+ require_jar('com.github.fge', 'uri-template', '0.9')
10
+ require_jar('com.github.java-json-tools', 'jackson-coreutils', '1.9')
11
+ require_jar('com.github.java-json-tools', 'json-schema-core', '1.2.10')
12
+ require_jar('com.github.java-json-tools', 'json-schema-validator', '2.2.10')
13
+ require_jar('org.logstash.plugins.input.http', 'logstash-filter-schema_validation', '0.2.0')
@@ -0,0 +1,109 @@
1
+ # encoding: utf-8
2
+ require "java"
3
+ require "logstash-filter-schema_validation"
4
+ require "logstash/filters/base"
5
+ require "logstash/namespace"
6
+
7
+ java_import "java.io.FileInputStream"
8
+ java_import "com.fasterxml.jackson.databind.JsonNode"
9
+ java_import "com.fasterxml.jackson.databind.ObjectMapper"
10
+ java_import "com.github.fge.jsonschema.core.report.ProcessingReport"
11
+ java_import "com.github.fge.jsonschema.main.JsonSchema"
12
+ java_import "com.github.fge.jsonschema.main.JsonSchemaFactory"
13
+ java_import "com.github.fge.jsonschema.cfg.ValidationConfigurationBuilder"
14
+
15
+ # This filter will replace the contents of the default
16
+ # message field with whatever you specify in the configuration.
17
+ #
18
+ # It is only intended to be used as an .
19
+ class LogStash::Filters::SchemaValidation < LogStash::Filters::Base
20
+
21
+ config_name "schema_validation"
22
+
23
+ # The path to JSON schema.
24
+ config :schema, :validate => :string, :required => true
25
+
26
+ # Retrieve errors.
27
+ config :report_field, :validate => :string, :default => nil
28
+
29
+ # Tags the event on failure to look up geo information. This can be used in later analysis.
30
+ config :tag_on_failure, :validate => :array, :default => ["_schema_validation_failure"]
31
+
32
+ public
33
+ def register
34
+ @schema = File.expand_path(@schema)
35
+
36
+ @schemaFactory = JsonSchemaFactory.newBuilder().freeze()
37
+
38
+ @jsonMapper = ObjectMapper.new
39
+ @validator = JsonSchemaFactory.byDefault().getValidator()
40
+
41
+ @cacheSchema = {}
42
+ end # def register
43
+
44
+ public
45
+ def filter(event)
46
+
47
+ schemaFilePath = generate_filepath(event)
48
+
49
+ if File.exists?(schemaFilePath)
50
+
51
+ schema = get_schema(schemaFilePath)
52
+
53
+ json = @jsonMapper.readTree(event.to_json)
54
+
55
+ #validationErrors = JSON::Validator.fully_validate(schemaFilePath, event.to_hash, :strict => @strict, :fragment => @fragment, :parse_data => false)
56
+
57
+ validationErrors = schema.validate(json)
58
+
59
+ if validationErrors.isSuccess
60
+ filter_matched(event)
61
+ else
62
+ tag_unsuccessful_lookup(event)
63
+
64
+ unless @report_field.nil? || @report_field.empty?
65
+ report = Array.new
66
+
67
+ validationErrors.each do |message|
68
+ report.push(message.getMessage)
69
+ end
70
+
71
+ event.set(@report_field, report)
72
+ end
73
+ end
74
+
75
+ else
76
+
77
+ @logger.fatal? && @logger.fatal("Schema file '" + schemaFilePath + "' does not exists!")
78
+
79
+ tag_unsuccessful_lookup(event)
80
+
81
+ unless @report_field.nil? || @report_field.empty?
82
+ event.set(@report_field, ["Schema file '" + schemaFilePath + "' does not exists!"])
83
+ end
84
+
85
+ end
86
+
87
+ end
88
+
89
+ def tag_unsuccessful_lookup(event)
90
+ @logger.debug? && @logger.debug("Event data is not valide!", :event => event)
91
+ @tag_on_failure.each{|tag| event.tag(tag)}
92
+ end
93
+
94
+ private
95
+ def generate_filepath(event)
96
+ event.sprintf(@schema)
97
+ end
98
+
99
+ private
100
+ def get_schema(name)
101
+ unless @cacheSchema.key?(name)
102
+ schema = @schemaFactory.getJsonSchema("file://" + name)
103
+ @cacheSchema[name] = schema
104
+ end
105
+
106
+ return @cacheSchema[name]
107
+ end
108
+
109
+ end
@@ -0,0 +1,26 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'logstash-filter-schema_validation'
3
+ s.version = '0.2.0'
4
+ s.licenses = ['Apache-2.0']
5
+ s.summary = 'Validate event schema with JSON Schema.'
6
+ s.description = 'Validate event schema with JSON Schema with json-schema ruby library.'
7
+ s.homepage = 'https://github.com/ebuildy/logstash-filter-schema_validation'
8
+ s.authors = ['Thomas Decaux']
9
+ s.email = 't.decaux@qwant.com'
10
+ s.require_paths = ["lib", "vendor/jar-dependencies"]
11
+
12
+ # Files
13
+ s.files = Dir["lib/**/*","spec/**/*","*.gemspec","*.md","CONTRIBUTORS","Gemfile","LICENSE","NOTICE.TXT", "vendor/jar-dependencies/**/*.jar", "vendor/jar-dependencies/**/*.rb", "VERSION", "docs/**/*"]
14
+ # Tests
15
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
16
+
17
+ # Special flag to let us know this is actually a logstash plugin
18
+ s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
19
+
20
+ # Gem dependencies
21
+ s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
22
+ s.add_runtime_dependency 'jar-dependencies', '~> 0.3.4'
23
+ s.add_development_dependency 'logstash-devutils'
24
+
25
+ s.platform = "java"
26
+ end
@@ -0,0 +1,111 @@
1
+ # encoding: utf-8
2
+ require_relative '../spec_helper'
3
+ require "logstash/filters/schema_validation"
4
+
5
+ describe LogStash::Filters::SchemaValidation do
6
+
7
+ before do
8
+ srand(RSpec.configuration.seed)
9
+ end
10
+
11
+ describe "With not existing schema file I should see the failure tag" do
12
+ let(:config) do <<-CONFIG
13
+ filter {
14
+ schema_validation {
15
+ schema => "/wrong_file.json"
16
+ report_field => "_errors"
17
+ tag_on_failure => "fail"
18
+ }
19
+ }
20
+ CONFIG
21
+ end
22
+
23
+ sample("message" => "some text") do
24
+ expect(subject).to include("tags")
25
+ expect(subject).to include("_errors")
26
+ expect(subject.get("tags")).to eq(["fail"])
27
+ expect(subject.get("_errors")).to eq(["Schema file '" + "/wrong_file.json" + "' does not exists!"])
28
+ end
29
+ end
30
+
31
+ describe "With a valid schema I should not see the failure tag" do
32
+ let(:config) do <<-CONFIG
33
+ filter {
34
+ schema_validation {
35
+ schema => "./spec/schemas/simple.json"
36
+ report_field => "_errors"
37
+ }
38
+ }
39
+ CONFIG
40
+ end
41
+
42
+ sample("firstName" => "tom", "lastName" => "Decaux", "age" => 34) do
43
+ expect(subject).not_to include("tags")
44
+ end
45
+ end
46
+
47
+ describe "Without respecting the schema I should see the failure tag and the error details" do
48
+ let(:config) do <<-CONFIG
49
+ filter {
50
+ schema_validation {
51
+ schema => "./spec/schemas/simple.json"
52
+ report_field => "_errors"
53
+ }
54
+ }
55
+ CONFIG
56
+ end
57
+
58
+ sample("firstName" => "tom", "lastame" => "Decaux", "age" => 34) do
59
+ puts subject.get("_errors")
60
+ expect(subject).to include("tags")
61
+ expect(subject.get("_errors")[0]).to include("object has missing required properties")
62
+ end
63
+ end
64
+
65
+ describe "With strict mode and an extra field I should get an error" do
66
+ let(:config) do <<-CONFIG
67
+ filter {
68
+ schema_validation {
69
+ schema => "./spec/schemas/simple_strict.json"
70
+ }
71
+ }
72
+ CONFIG
73
+ end
74
+
75
+ sample("firstName" => "tom", "lastName" => "Decaux", "age" => 34, "sex" => "enormous") do
76
+ expect(subject).to include("tags")
77
+ end
78
+ end
79
+
80
+ describe "I should specify the schema file via environment variable" do
81
+ let(:config) do <<-CONFIG
82
+ filter {
83
+ schema_validation {
84
+ schema => "./spec/schemas/${ENV_SCHEMA}.json"
85
+ report_field => "_errors"
86
+ }
87
+ }
88
+ CONFIG
89
+ end
90
+
91
+ sample("firstName" => "tom", "lastName" => "Decaux", "age" => 34, "sex" => "enormous") do
92
+ expect(subject).not_to include("tags")
93
+ end
94
+ end
95
+
96
+ describe "I should specify the schema file via event data" do
97
+ let(:config) do <<-CONFIG
98
+ filter {
99
+ schema_validation {
100
+ schema => "./spec/schemas/%{schema}.json"
101
+ report_field => "_errors"
102
+ }
103
+ }
104
+ CONFIG
105
+ end
106
+
107
+ sample("firstName" => "tom", "lastName" => "Decaux", "age" => 34, "sex" => "enormous", "schema" => "simple") do
108
+ expect(subject).not_to include("tags")
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,31 @@
1
+ input
2
+ {
3
+ http
4
+ {
5
+ port => 8081
6
+ }
7
+ }
8
+
9
+ filter
10
+ {
11
+ mutate
12
+ {
13
+ rename => { "headers" => "[@metadata][headers]" }
14
+ remove_field => [ "host" ]
15
+ }
16
+
17
+ schema_validation
18
+ {
19
+ schema => "/usr/share/logstash/__schemas/%{schema}.json"
20
+ report_field => "_validation_errors"
21
+ }
22
+ }
23
+
24
+ output
25
+ {
26
+ #
27
+ #stdout
28
+ #{
29
+ # codec => rubydebug
30
+ #}
31
+ }
@@ -0,0 +1,68 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+
4
+ "definitions": {
5
+ "client": {
6
+ "type": "object",
7
+ "properties": {
8
+ "origin": { "type": "string" },
9
+ "locale": { "type": "string" },
10
+ "user_agent": { "type": "string" },
11
+ "test_group": { "type": "integer" },
12
+ "token": { "type": "string" },
13
+ "ip": { "type": "string" }
14
+ },
15
+ "required": ["locale", "user_agent", "token"]
16
+ },
17
+ "request": {
18
+ "type": "object",
19
+ "properties": {
20
+ "client": { "type": "string" },
21
+ "type": { "type": "string" },
22
+ "method": { "type": "string" },
23
+ "host": { "type": "string" },
24
+ "uri": { "type": "string" },
25
+ "server": { "type": "string" },
26
+ "spam_score": { "type": "integer" },
27
+ "referer": { "type": "string" },
28
+ "referer_host": { "type": "string" },
29
+ "referer_scheme": { "type": "string" },
30
+ "referer_domain": { "type": "string" }
31
+ }
32
+ },
33
+ "product": {
34
+ "type": "object",
35
+ "properties": {
36
+ "module": { "type": "string" },
37
+ "version": { "type": "string" },
38
+ "name": { "type": "string" }
39
+ },
40
+ "required": ["module", "version", "name"]
41
+ },
42
+ "data_search": {
43
+ "type": "object",
44
+ "properties": {
45
+ "query": { "type": "string" },
46
+ "domain": { "type": "string" },
47
+ "tab": { "type": "string" }
48
+ },
49
+ "required": ["query", "domain", "tab"]
50
+ }
51
+ },
52
+
53
+ "type" : "object",
54
+ "properties" : {
55
+ "name" : { "type" : "string" },
56
+ "schema" : { "type" : "string" },
57
+ "@version" : { "type" : "string" },
58
+ "@timestamp" : { "type" : "string" },
59
+ "date" : { "type" : "integer" },
60
+ "client" : { "$ref" : "#/definitions/client" },
61
+ "request" : { "$ref" : "#/definitions/request" },
62
+ "product" : { "$ref" : "#/definitions/product" },
63
+ "data" : { "$ref" : "#/definitions/data_search" }
64
+ },
65
+ "required": ["name", "date", "client"],
66
+ "additionalProperties" : false
67
+
68
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "type" : "object",
3
+ "required": ["firstName", "lastName"],
4
+ "properties" : {
5
+ "firstName": {
6
+ "type": "string"
7
+ },
8
+ "lastName": {
9
+ "type": "string"
10
+ },
11
+ "age": {
12
+ "description": "Age in years",
13
+ "type": "integer",
14
+ "minimum": 0
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "type" : "object",
3
+ "properties" : {
4
+ "name" : {
5
+ "type" : "object",
6
+ "properties" : {
7
+ "first": {
8
+ "type": "string"
9
+ },
10
+ "last": {
11
+ "type": "string"
12
+ }
13
+ },
14
+ "required": ["first", "last"]
15
+ },
16
+ "age": {
17
+ "description": "Age in years",
18
+ "type": "integer",
19
+ "minimum": 0
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "type" : "object",
3
+ "additionalProperties" : false,
4
+ "required": ["firstName", "lastName"],
5
+ "properties" : {
6
+ "firstName": {
7
+ "type": "string"
8
+ },
9
+ "lastName": {
10
+ "type": "string"
11
+ },
12
+ "age": {
13
+ "description": "Age in years",
14
+ "type": "integer",
15
+ "minimum": 0
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "firstName": {
3
+ "type": "toto"
4
+ },
5
+ "lastName": {
6
+ "dsdsds": "string"
7
+ },
8
+ "age": {
9
+ "description": "Age in years",
10
+ "type": "integer",
11
+ "minimum": 0
12
+ },
13
+ "required": []
14
+ }
@@ -0,0 +1,2 @@
1
+ # encoding: utf-8
2
+ require "logstash/devutils/rspec/spec_helper"
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: logstash-filter-schema_validation
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: java
6
+ authors:
7
+ - Thomas Decaux
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-05-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: logstash-core-plugin-api
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '1.60'
20
+ - - "<="
21
+ - !ruby/object:Gem::Version
22
+ version: '2.99'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '1.60'
30
+ - - "<="
31
+ - !ruby/object:Gem::Version
32
+ version: '2.99'
33
+ - !ruby/object:Gem::Dependency
34
+ name: jar-dependencies
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 0.3.4
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: 0.3.4
47
+ - !ruby/object:Gem::Dependency
48
+ name: logstash-devutils
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ description: Validate event schema with JSON Schema with json-schema ruby library.
62
+ email: t.decaux@qwant.com
63
+ executables: []
64
+ extensions: []
65
+ extra_rdoc_files: []
66
+ files:
67
+ - CHANGELOG.md
68
+ - CONTRIBUTORS
69
+ - DEVELOPER.md
70
+ - Gemfile
71
+ - LICENSE
72
+ - README.md
73
+ - VERSION
74
+ - lib/logstash-filter-schema_validation.rb
75
+ - lib/logstash/filters/schema_validation.rb
76
+ - logstash-filter-schema_validation.gemspec
77
+ - spec/filters/schema-validator_spec.rb
78
+ - spec/pipelines/test.conf
79
+ - spec/schemas/http.json
80
+ - spec/schemas/simple.json
81
+ - spec/schemas/simple0.json
82
+ - spec/schemas/simple_strict.json
83
+ - spec/schemas/wrong.json
84
+ - spec/spec_helper.rb
85
+ - vendor/jar-dependencies/com/github/everit-org/json-schema/org.everit.json.schema/1.8.0/org.everit.json.schema-1.8.0.jar
86
+ - vendor/jar-dependencies/com/github/fge/btf/1.2/btf-1.2.jar
87
+ - vendor/jar-dependencies/com/github/fge/msg-simple/1.1/msg-simple-1.1.jar
88
+ - vendor/jar-dependencies/com/github/fge/uri-template/0.9/uri-template-0.9.jar
89
+ - vendor/jar-dependencies/com/github/java-json-tools/jackson-coreutils/1.9/jackson-coreutils-1.9.jar
90
+ - vendor/jar-dependencies/com/github/java-json-tools/json-schema-core/1.2.10/json-schema-core-1.2.10.jar
91
+ - vendor/jar-dependencies/com/github/java-json-tools/json-schema-validator/2.2.10/json-schema-validator-2.2.10.jar
92
+ - vendor/jar-dependencies/com/google/guava/guava/16.0.1/guava-16.0.1.jar
93
+ - vendor/jar-dependencies/com/googlecode/libphonenumber/libphonenumber/8.0.0/libphonenumber-8.0.0.jar
94
+ - vendor/jar-dependencies/io/netty/netty-all/4.1.18.Final/netty-all-4.1.18.Final.jar
95
+ - vendor/jar-dependencies/io/netty/netty-tcnative-boringssl-static/2.0.7.Final/netty-tcnative-boringssl-static-2.0.7.Final.jar
96
+ - vendor/jar-dependencies/javax/mail/javax.mail-api/1.5.1/javax.mail-api-1.5.1.jar
97
+ - vendor/jar-dependencies/org/apache/logging/log4j/log4j-api/2.6.2/log4j-api-2.6.2.jar
98
+ - vendor/jar-dependencies/org/logstash/plugins/input/http/logstash-filter-schema_validation/0.2.0/logstash-filter-schema_validation-0.2.0.jar
99
+ homepage: https://github.com/ebuildy/logstash-filter-schema_validation
100
+ licenses:
101
+ - Apache-2.0
102
+ metadata:
103
+ logstash_plugin: 'true'
104
+ logstash_group: filter
105
+ post_install_message:
106
+ rdoc_options: []
107
+ require_paths:
108
+ - lib
109
+ - vendor/jar-dependencies
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ requirements: []
121
+ rubyforge_project:
122
+ rubygems_version: 2.6.14
123
+ signing_key:
124
+ specification_version: 4
125
+ summary: Validate event schema with JSON Schema.
126
+ test_files:
127
+ - spec/filters/schema-validator_spec.rb
128
+ - spec/pipelines/test.conf
129
+ - spec/schemas/http.json
130
+ - spec/schemas/simple.json
131
+ - spec/schemas/simple0.json
132
+ - spec/schemas/simple_strict.json
133
+ - spec/schemas/wrong.json
134
+ - spec/spec_helper.rb