logstash-filter-schema_validation 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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +6 -0
- data/logstash-filter-schema_validation.gemspec +3 -3
- data/spec/filters/schema-validator_spec.rb +32 -1
- data/spec/pipelines/test.conf +31 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11f00726f4ab414cca8bf37f094c350b9937c332
|
4
|
+
data.tar.gz: 8fc42406fba7e10d8b174dbb0ead99320e5fb128
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a51225cf65c36d7dc12cb73b61203a99ea5fade5526ad285eadf1c48550c0c25951fcbb46aeef43e93f4cfed90682a6f934d579b1f2906528bf29253d2a71da
|
7
|
+
data.tar.gz: e4b65b551d81668f2962654767c3978cb0d36c91da853a1b47fd33936cf29010386242df1a84cf56987dff596067f1e4d0b3742543582de4e73fdd3d63045cd2
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
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
2
|
|
3
|
+
https://rubygems.org/gems/logstash-filter-schema_validation
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
``logstash-plugin install logstash-filter-schema_validation``
|
8
|
+
|
3
9
|
|
4
10
|
# Logstash Plugin
|
5
11
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-filter-schema_validation'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.1'
|
4
4
|
s.licenses = ['Apache-2.0']
|
5
5
|
s.summary = 'Validate event schema with JSON Schema.'
|
6
|
-
s.description = 'Validate event schema with JSON Schema.'
|
7
|
-
s.homepage = 'https://github.com'
|
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
8
|
s.authors = ['Thomas Decaux']
|
9
9
|
s.email = 't.decaux@qwant.com'
|
10
10
|
s.require_paths = ['lib']
|
@@ -74,7 +74,6 @@ describe LogStash::Filters::SchemaValidation do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
sample("firstName" => "tom", "lastame" => "Decaux", "age" => 34) do
|
77
|
-
puts subject.to_hash.to_s
|
78
77
|
expect(subject).to include("tags")
|
79
78
|
expect(subject.get("_errors")[0]).to include("The property '#/' did not contain a required property of 'lastName'")
|
80
79
|
end
|
@@ -95,4 +94,36 @@ describe LogStash::Filters::SchemaValidation do
|
|
95
94
|
expect(subject).to include("tags")
|
96
95
|
end
|
97
96
|
end
|
97
|
+
|
98
|
+
describe "I should specify the schema file via environment variable" do
|
99
|
+
let(:config) do <<-CONFIG
|
100
|
+
filter {
|
101
|
+
schema_validation {
|
102
|
+
schema => "./spec/schemas/${ENV_SCHEMA}.json"
|
103
|
+
report_field => "_errors"
|
104
|
+
}
|
105
|
+
}
|
106
|
+
CONFIG
|
107
|
+
end
|
108
|
+
|
109
|
+
sample("firstName" => "tom", "lastName" => "Decaux", "age" => 34, "sex" => "enormous") do
|
110
|
+
expect(subject).not_to include("tags")
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
describe "I should specify the schema file via event data" do
|
115
|
+
let(:config) do <<-CONFIG
|
116
|
+
filter {
|
117
|
+
schema_validation {
|
118
|
+
schema => "./spec/schemas/%{schema}.json"
|
119
|
+
report_field => "_errors"
|
120
|
+
}
|
121
|
+
}
|
122
|
+
CONFIG
|
123
|
+
end
|
124
|
+
|
125
|
+
sample("firstName" => "tom", "lastName" => "Decaux", "age" => 34, "sex" => "enormous", "schema" => "simple") do
|
126
|
+
expect(subject).not_to include("tags")
|
127
|
+
end
|
128
|
+
end
|
98
129
|
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
|
+
strict => true
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
output
|
26
|
+
{
|
27
|
+
stdout
|
28
|
+
{
|
29
|
+
codec => rubydebug
|
30
|
+
}
|
31
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-schema_validation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Decaux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-core-plugin-api
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description: Validate event schema with JSON Schema.
|
55
|
+
description: Validate event schema with JSON Schema with json-schema ruby library.
|
56
56
|
email: t.decaux@qwant.com
|
57
57
|
executables: []
|
58
58
|
extensions: []
|
@@ -67,11 +67,12 @@ files:
|
|
67
67
|
- lib/logstash/filters/schema_validation.rb
|
68
68
|
- logstash-filter-schema_validation.gemspec
|
69
69
|
- spec/filters/schema-validator_spec.rb
|
70
|
+
- spec/pipelines/test.conf
|
70
71
|
- spec/schemas/simple.json
|
71
72
|
- spec/schemas/simple0.json
|
72
73
|
- spec/schemas/wrong.json
|
73
74
|
- spec/spec_helper.rb
|
74
|
-
homepage: https://github.com
|
75
|
+
homepage: https://github.com/ebuildy/logstash-filter-schema_validation
|
75
76
|
licenses:
|
76
77
|
- Apache-2.0
|
77
78
|
metadata:
|
@@ -99,6 +100,7 @@ specification_version: 4
|
|
99
100
|
summary: Validate event schema with JSON Schema.
|
100
101
|
test_files:
|
101
102
|
- spec/filters/schema-validator_spec.rb
|
103
|
+
- spec/pipelines/test.conf
|
102
104
|
- spec/schemas/simple.json
|
103
105
|
- spec/schemas/simple0.json
|
104
106
|
- spec/schemas/wrong.json
|