logstash-filter-de_dot 0.1.3 → 1.0.0
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/LICENSE +1 -1
- data/README.md +12 -3
- data/lib/logstash/filters/de_dot.rb +2 -2
- data/logstash-filter-de_dot.gemspec +3 -3
- data/spec/filters/de_dot_spec.rb +24 -24
- metadata +13 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c9fbb0c46943be7a2e1c806ae826e04af455df6
|
4
|
+
data.tar.gz: 65ffbc5f47614653cbe0e5af09621f43c961df8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4eb5e878e39c2308be6a8e7a8f7d2a6d6e8cec8af0230f15fa6cd11645654fc5a03064ee1fc77ba234ef81c4290711396e184d51ec1b1757c576c6f12f18c74d
|
7
|
+
data.tar.gz: 57c92a6cb4abab5fef4bf44d92b2141312483853991d836975c07fc62fc85c861b4fcd666c364a73e6f33d3910bce15a5be190792d7d5e5bf24ea534e76154eb
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# 1.0.0
|
2
|
+
- Depend on the correct version of logstash-core-plugin-api to work with
|
3
|
+
Logstash 5.0
|
4
|
+
- Fix all event references to use event.get() and event.set() methodology
|
1
5
|
# 0.1.3
|
2
6
|
- Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash
|
3
7
|
# 0.1.2
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# Logstash Plugin
|
2
2
|
|
3
|
-
[![Build
|
4
|
-
Status](http://build-eu-00.elastic.co/view/LS%20Plugins/view/LS%20Filters/job/logstash-plugin-filter-example-unit/badge/icon)](http://build-eu-00.elastic.co/view/LS%20Plugins/view/LS%20Filters/job/logstash-plugin-filter-example-unit/)
|
3
|
+
[![Travis Build Status](https://travis-ci.org/logstash-plugins/logstash-filter-de_dot.svg)](https://travis-ci.org/logstash-plugins/logstash-filter-de_dot)
|
5
4
|
|
6
5
|
This is a plugin for [Logstash](https://github.com/elastic/logstash).
|
7
6
|
|
@@ -56,7 +55,12 @@ gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
|
|
56
55
|
```
|
57
56
|
- Install plugin
|
58
57
|
```sh
|
58
|
+
# Logstash 2.3 and higher
|
59
|
+
bin/logstash-plugin install --no-verify
|
60
|
+
|
61
|
+
# Prior to Logstash 2.3
|
59
62
|
bin/plugin install --no-verify
|
63
|
+
|
60
64
|
```
|
61
65
|
- Run Logstash with your plugin
|
62
66
|
```sh
|
@@ -74,7 +78,12 @@ gem build logstash-filter-awesome.gemspec
|
|
74
78
|
```
|
75
79
|
- Install the plugin from the Logstash home
|
76
80
|
```sh
|
77
|
-
|
81
|
+
# Logstash 2.3 and higher
|
82
|
+
bin/logstash-plugin install --no-verify
|
83
|
+
|
84
|
+
# Prior to Logstash 2.3
|
85
|
+
bin/plugin install --no-verify
|
86
|
+
|
78
87
|
```
|
79
88
|
- Start Logstash and proceed to test the plugin
|
80
89
|
|
@@ -71,7 +71,7 @@ class LogStash::Filters::De_dot < LogStash::Filters::Base
|
|
71
71
|
@logger.debug? && @logger.debug("de_dot: source field reference", :fieldref => fieldref)
|
72
72
|
newref = fieldref.gsub('.', @separator)
|
73
73
|
@logger.debug? && @logger.debug("de_dot: replacement field reference", :newref => newref)
|
74
|
-
event
|
74
|
+
event.set(newref, event.get(fieldref))
|
75
75
|
@logger.debug? && @logger.debug("de_dot: event with both new and old field references", :event => event.to_hash.to_s)
|
76
76
|
event.remove(find_fieldref_for_delete(fieldref))
|
77
77
|
@logger.debug? && @logger.debug("de_dot: postprocess", :event => event.to_hash.to_s)
|
@@ -88,7 +88,7 @@ class LogStash::Filters::De_dot < LogStash::Filters::Base
|
|
88
88
|
end
|
89
89
|
@logger.debug? && @logger.debug("de_dot: Act on these fields", :fields => fields)
|
90
90
|
fields.each do |ref|
|
91
|
-
if event
|
91
|
+
if event.get(ref)
|
92
92
|
rename_field(event, ref) if has_dot?(ref)
|
93
93
|
end
|
94
94
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-filter-de_dot'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '1.0.0'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
5
|
s.summary = "This filter removes dots from field names and replaces them with a different separator."
|
6
|
-
s.description
|
6
|
+
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|
7
7
|
s.authors = ["Elastic"]
|
8
8
|
s.email = 'info@elastic.co'
|
9
9
|
s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
|
@@ -18,6 +18,6 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
|
19
19
|
|
20
20
|
# Gem dependencies
|
21
|
-
s.add_runtime_dependency "logstash-core-plugin-api", "
|
21
|
+
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
|
22
22
|
s.add_development_dependency 'logstash-devutils'
|
23
23
|
end
|
data/spec/filters/de_dot_spec.rb
CHANGED
@@ -26,7 +26,7 @@ describe LogStash::Filters::De_dot do
|
|
26
26
|
it "should replace a dot with an underscore" do
|
27
27
|
subject.filter(event)
|
28
28
|
expect(event.to_hash.keys).not_to include('foo.bar')
|
29
|
-
expect(event
|
29
|
+
expect(event.get('foo_bar')).to eq('pass')
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -37,7 +37,7 @@ describe LogStash::Filters::De_dot do
|
|
37
37
|
it "should replace a dot with an underscore" do
|
38
38
|
subject.filter(event)
|
39
39
|
expect(event.to_hash.keys).not_to include('foo.bar')
|
40
|
-
expect(event
|
40
|
+
expect(event.get('foo___bar')).to eq('pass')
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -47,13 +47,13 @@ describe LogStash::Filters::De_dot do
|
|
47
47
|
it "should replace all dots with underscores" do
|
48
48
|
subject.filter(event)
|
49
49
|
expect(event.to_hash.keys).not_to include('acme.roller.skates')
|
50
|
-
expect(event
|
50
|
+
expect(event.get('acme_roller_skates')).to eq('coyote')
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should not change a field without dots" do
|
54
54
|
subject.filter(event)
|
55
55
|
expect(event.to_hash.keys).to include('nodot')
|
56
|
-
expect(event
|
56
|
+
expect(event.get('nodot')).to eq('nochange')
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -63,13 +63,13 @@ describe LogStash::Filters::De_dot do
|
|
63
63
|
it "should replace all dots with underscores" do
|
64
64
|
subject.filter(event)
|
65
65
|
expect(event.to_hash.keys).not_to include('acme_roller.skates')
|
66
|
-
expect(event
|
66
|
+
expect(event.get('acme_roller_skates')).to eq('coyote')
|
67
67
|
end
|
68
68
|
|
69
69
|
it "should not change a field without dots" do
|
70
70
|
subject.filter(event)
|
71
71
|
expect(event.to_hash.keys).to include('no_dot')
|
72
|
-
expect(event
|
72
|
+
expect(event.get('no_dot')).to eq('nochange')
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
@@ -80,13 +80,13 @@ describe LogStash::Filters::De_dot do
|
|
80
80
|
it "should convert dotted fields to sub-fields" do
|
81
81
|
subject.filter(event)
|
82
82
|
expect(event.to_hash.keys).not_to include('acme.roller.skates')
|
83
|
-
expect(event
|
83
|
+
expect(event.get('[acme][roller][skates]')).to eq('coyote')
|
84
84
|
end
|
85
85
|
|
86
86
|
it "should not change a field without dots" do
|
87
87
|
subject.filter(event)
|
88
88
|
expect(event.to_hash.keys).to include('nodot')
|
89
|
-
expect(event
|
89
|
+
expect(event.get('nodot')).to eq('nochange')
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
@@ -96,14 +96,14 @@ describe LogStash::Filters::De_dot do
|
|
96
96
|
|
97
97
|
it "should replace all dots with underscores within specified fields" do
|
98
98
|
subject.filter(event)
|
99
|
-
expect(event
|
100
|
-
expect(event
|
99
|
+
expect(event.get('acme')).not_to include('roller.skates')
|
100
|
+
expect(event.get('[acme][roller_skates]')).to eq('coyote')
|
101
101
|
end
|
102
102
|
|
103
103
|
it "should not change a field not listed, even with dots" do
|
104
104
|
subject.filter(event)
|
105
105
|
expect(event.to_hash.keys).to include('foo.bar')
|
106
|
-
expect(event
|
106
|
+
expect(event.get('foo.bar')).to eq('nochange')
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
@@ -124,12 +124,12 @@ describe LogStash::Filters::De_dot do
|
|
124
124
|
|
125
125
|
it "should replace all dots with underscores within specified fields" do
|
126
126
|
subject.filter(event)
|
127
|
-
expect(event
|
128
|
-
expect(event
|
127
|
+
expect(event.get('acme')).not_to include('roller.skates')
|
128
|
+
expect(event.get('[acme][roller][skates]')).to eq('coyote')
|
129
129
|
expect(event.to_hash.keys).not_to include('foo.bar')
|
130
|
-
expect(event
|
130
|
+
expect(event.get('[foo][bar]')).to eq('nochange')
|
131
131
|
expect(event.to_hash.keys).not_to include('a.b')
|
132
|
-
expect(event
|
132
|
+
expect(event.get('[a][b][c][d][e][f]')).to eq('finally')
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
@@ -149,10 +149,10 @@ describe LogStash::Filters::De_dot do
|
|
149
149
|
|
150
150
|
it "should replace all dots with underscores within specified fields" do
|
151
151
|
subject.filter(event)
|
152
|
-
expect(event
|
153
|
-
expect(event
|
152
|
+
expect(event.get('acme')).not_to include('roller.skates')
|
153
|
+
expect(event.get('[acme][roller][skates]')).to eq('coyote')
|
154
154
|
expect(event.to_hash.keys).not_to include('a.b')
|
155
|
-
expect(event
|
155
|
+
expect(event.get('[a][b][c][d][e][f]')).to eq('finally')
|
156
156
|
end
|
157
157
|
|
158
158
|
it "should not add [foo][bar]" do
|
@@ -177,14 +177,14 @@ describe LogStash::Filters::De_dot do
|
|
177
177
|
|
178
178
|
it "should replace all dots with underscores" do
|
179
179
|
subject.filter(event)
|
180
|
-
expect(event
|
181
|
-
expect(event
|
180
|
+
expect(event.get('acme')).not_to include('super.roller_skates')
|
181
|
+
expect(event.get('[acme][super_roller_skates')).to eq('coyote')
|
182
182
|
end
|
183
183
|
|
184
184
|
it "should not change a field without dots" do
|
185
185
|
subject.filter(event)
|
186
186
|
expect(event.to_hash.keys).to include('field_with')
|
187
|
-
expect(event
|
187
|
+
expect(event.get('[field_with][no_dot]')).to eq('nochange')
|
188
188
|
end
|
189
189
|
end
|
190
190
|
|
@@ -204,14 +204,14 @@ describe LogStash::Filters::De_dot do
|
|
204
204
|
|
205
205
|
it "should replace all dots with underscores" do
|
206
206
|
subject.filter(event)
|
207
|
-
expect(event
|
208
|
-
expect(event
|
207
|
+
expect(event.get('acme')).not_to include('super.roller_skates')
|
208
|
+
expect(event.get('[acme][super][roller_skates')).to eq('coyote')
|
209
209
|
end
|
210
210
|
|
211
211
|
it "should not change a field without dots" do
|
212
212
|
subject.filter(event)
|
213
213
|
expect(event.to_hash.keys).to include('field_with')
|
214
|
-
expect(event
|
214
|
+
expect(event.get('[field_with][no_dot]')).to eq('nochange')
|
215
215
|
end
|
216
216
|
end
|
217
217
|
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-de_dot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
|
-
- - "
|
16
|
+
- - ">="
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '1.60'
|
19
|
+
- - "<="
|
17
20
|
- !ruby/object:Gem::Version
|
18
|
-
version: '
|
21
|
+
version: '2.99'
|
19
22
|
name: logstash-core-plugin-api
|
20
23
|
prerelease: false
|
21
24
|
type: :runtime
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.60'
|
30
|
+
- - "<="
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
32
|
+
version: '2.99'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
requirement: !ruby/object:Gem::Requirement
|
29
35
|
requirements:
|
@@ -38,7 +44,7 @@ dependencies:
|
|
38
44
|
- - ">="
|
39
45
|
- !ruby/object:Gem::Version
|
40
46
|
version: '0'
|
41
|
-
description: This gem is a
|
47
|
+
description: This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program
|
42
48
|
email: info@elastic.co
|
43
49
|
executables: []
|
44
50
|
extensions: []
|