logstash-filter-mutate 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48c014f4bea7404736c72a05151230e8793c3122
4
- data.tar.gz: 7a12aa1cad1926924cc47a8b12353c30454b8e53
3
+ metadata.gz: 40ecc561b49dd4b34c7fdeecf64b61906a7a447f
4
+ data.tar.gz: 71b560c9ca6fd2c235698a2725bc39d9293c7eba
5
5
  SHA512:
6
- metadata.gz: f90806f263c7cc45692a956f6935bdc0dee5c160edc39b6cfb0348f91adf76552b053a4e68e780d3647bdc6ea9e79a4f5ed25e80996885d98cf8fcf904b98248
7
- data.tar.gz: 1f43ab694b35d2b41aa26dbebf8ad64c5b089e2a70ca6f4d7c58d74dbe2078792bed72cd3b5afb222c231f02af010c1e38d4ebc55ad951c6da72af620332dc4d
6
+ metadata.gz: ed2ea43790884e1b04262a9399dd8a01478a41b44e8ceed978f4e1cc29a12fda769ca47098a8f29a6004e32d27b3c0ff74c3b5666fffd5480ad6f641c8ce6ee0
7
+ data.tar.gz: 8ee47a280ae3e202e6c22a9b14c7768ffdadd177ff61ebe6284aa2a5104c93594ca60f5428c20677effbe2424065112571ec214784ba5881ff799f143712ac27
@@ -1,5 +1,8 @@
1
+ ## 3.1.2
2
+ - bugfix: split method was not working, #78
3
+
1
4
  ## 3.1.1
2
- - Relax constraint on logstash-core-plugin-api to >= 1.60 <= 2.99
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 = eventget(field)
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.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"
@@ -43,7 +43,6 @@ filter {
43
43
  grok {
44
44
  match => { "message" => "(?:hello) %{WORD:bar}" }
45
45
  break_on_match => false
46
- singles => true
47
46
  }
48
47
  mutate {
49
48
  lowercase => [ "bar", "lower1", "lower2" ]
@@ -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.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-07-14 00:00:00.000000000 Z
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.6.3
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.