logstash-filter-mutate 3.1.1 → 3.1.2
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 +4 -4
- data/CHANGELOG.md +4 -1
- data/lib/logstash/filters/mutate.rb +1 -1
- data/logstash-filter-mutate.gemspec +1 -1
- data/spec/filters/integration/multi_stage_spec.rb +0 -1
- data/spec/filters/mutate_spec.rb +49 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40ecc561b49dd4b34c7fdeecf64b61906a7a447f
|
4
|
+
data.tar.gz: 71b560c9ca6fd2c235698a2725bc39d9293c7eba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed2ea43790884e1b04262a9399dd8a01478a41b44e8ceed978f4e1cc29a12fda769ca47098a8f29a6004e32d27b3c0ff74c3b5666fffd5480ad6f641c8ce6ee0
|
7
|
+
data.tar.gz: 8ee47a280ae3e202e6c22a9b14c7768ffdadd177ff61ebe6284aa2a5104c93594ca60f5428c20677effbe2424065112571ec214784ba5881ff799f143712ac27
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
+
## 3.1.2
|
2
|
+
- bugfix: split method was not working, #78
|
3
|
+
|
1
4
|
## 3.1.1
|
2
|
-
|
5
|
+
- Relax constraint on logstash-core-plugin-api to >= 1.60 <= 2.99
|
3
6
|
|
4
7
|
## 3.1.0
|
5
8
|
- breaking,config: Remove deprecated config `remove`. Please use generic `remove_field` instead.
|
@@ -366,7 +366,7 @@ class LogStash::Filters::Mutate < LogStash::Filters::Base
|
|
366
366
|
|
367
367
|
def split(event)
|
368
368
|
@split.each do |field, separator|
|
369
|
-
value =
|
369
|
+
value = event.get(field)
|
370
370
|
if value.is_a?(String)
|
371
371
|
event.set(field, value.split(separator))
|
372
372
|
else
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-filter-mutate'
|
4
|
-
s.version = '3.1.
|
4
|
+
s.version = '3.1.2'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "The mutate filter allows you to perform general mutations on fields. You can rename, remove, replace, and modify fields in your events."
|
7
7
|
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"
|
data/spec/filters/mutate_spec.rb
CHANGED
@@ -115,6 +115,55 @@ describe LogStash::Filters::Mutate do
|
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
|
+
describe "#split" do
|
119
|
+
|
120
|
+
let(:config) do
|
121
|
+
{ "split" => {"field" => "," } }
|
122
|
+
end
|
123
|
+
|
124
|
+
context "when source field is a string" do
|
125
|
+
|
126
|
+
let(:attrs) { { "field" => "foo,bar,baz" } }
|
127
|
+
|
128
|
+
it "should split string into array" do
|
129
|
+
subject.filter(event)
|
130
|
+
expect(event.get("field")).to eq(["foo","bar","baz"])
|
131
|
+
end
|
132
|
+
|
133
|
+
it "should convert single field to array" do
|
134
|
+
event.set("field","foo")
|
135
|
+
subject.filter(event)
|
136
|
+
expect(event.get("field")).to eq(["foo"])
|
137
|
+
|
138
|
+
event.set("field","foo,")
|
139
|
+
subject.filter(event)
|
140
|
+
expect(event.get("field")).to eq(["foo"])
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
context "when source field is not a string" do
|
146
|
+
|
147
|
+
it "should not modify source field nil" do
|
148
|
+
event.set("field",nil)
|
149
|
+
subject.filter(event)
|
150
|
+
expect(event.get("field")).to eq(nil)
|
151
|
+
end
|
152
|
+
|
153
|
+
it "should not modify source field array" do
|
154
|
+
event.set("field",["foo","bar"])
|
155
|
+
subject.filter(event)
|
156
|
+
expect(event.get("field")).to eq(["foo","bar"])
|
157
|
+
end
|
158
|
+
|
159
|
+
it "should not modify source field hash" do
|
160
|
+
event.set("field",{"foo" => "bar,baz"})
|
161
|
+
subject.filter(event)
|
162
|
+
expect(event.get("field")).to eq({"foo" => "bar,baz"})
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
118
167
|
end
|
119
168
|
|
120
169
|
describe LogStash::Filters::Mutate do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-mutate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.2
|
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-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
110
|
version: '0'
|
111
111
|
requirements: []
|
112
112
|
rubyforge_project:
|
113
|
-
rubygems_version: 2.
|
113
|
+
rubygems_version: 2.4.8
|
114
114
|
signing_key:
|
115
115
|
specification_version: 4
|
116
116
|
summary: The mutate filter allows you to perform general mutations on fields. You can rename, remove, replace, and modify fields in your events.
|