logstash-filter-schema_validation 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b0fd330702ae7941577dc6adaf29fac086f19f0
4
- data.tar.gz: 3411d1f9869a505a72c38d26308bc98c84911df4
3
+ metadata.gz: 11f00726f4ab414cca8bf37f094c350b9937c332
4
+ data.tar.gz: 8fc42406fba7e10d8b174dbb0ead99320e5fb128
5
5
  SHA512:
6
- metadata.gz: 41bed013add021de3d5632347d748de9afa58f9c7a793d7753821e1062b1582d0479628d8066fad98ce552c9dc6934f64b385e640b97d1fac28b213ad58eb666
7
- data.tar.gz: b7125e9d39da9f8662244dfb75da599d0e83f1db7ef251ef1da2228e471002ba2cbe1e09862d07f352d2a82b180bd6e2c2438b5ebec5e8828e85af12a1aa03aa
6
+ metadata.gz: 0a51225cf65c36d7dc12cb73b61203a99ea5fade5526ad285eadf1c48550c0c25951fcbb46aeef43e93f4cfed90682a6f934d579b1f2906528bf29253d2a71da
7
+ data.tar.gz: e4b65b551d81668f2962654767c3978cb0d36c91da853a1b47fd33936cf29010386242df1a84cf56987dff596067f1e4d0b3742543582de4e73fdd3d63045cd2
@@ -1,2 +1,6 @@
1
+ ## 0.1.0
2
+ - Add spec tests
3
+ - Refactor docker-compose stuff
4
+
1
5
  ## 0.1.0
2
6
  - Plugin created with the logstash plugin generator
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.0'
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.0
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 00:00:00.000000000 Z
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