logstash-filter-mutate 3.1.2 → 3.1.3

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: 40ecc561b49dd4b34c7fdeecf64b61906a7a447f
4
- data.tar.gz: 71b560c9ca6fd2c235698a2725bc39d9293c7eba
3
+ metadata.gz: a56a7078074ef2704ec10834c3e7fe7a664ee647
4
+ data.tar.gz: 726266e6349d2ecbb8570932c19260a029d0b321
5
5
  SHA512:
6
- metadata.gz: ed2ea43790884e1b04262a9399dd8a01478a41b44e8ceed978f4e1cc29a12fda769ca47098a8f29a6004e32d27b3c0ff74c3b5666fffd5480ad6f641c8ce6ee0
7
- data.tar.gz: 8ee47a280ae3e202e6c22a9b14c7768ffdadd177ff61ebe6284aa2a5104c93594ca60f5428c20677effbe2424065112571ec214784ba5881ff799f143712ac27
6
+ metadata.gz: c034a0c3708ed37330f6fd18746f6fe47a1f0524417e78483c1f56b6115469b0d37da39621c8b67be9ecc187f6c0a9b30fd3f8f37f181b62ec7573ef5f66af5e
7
+ data.tar.gz: b9f614d74196e90d942b87f376c8f64d4127d544126331b17b20f105bc30b61e1e9545a3d87ce093cad416b8272ab397d29e2bebb67227aa310e544ba82f9f51
@@ -1,3 +1,6 @@
1
+ ## 3.1.3
2
+ - Don't create empty fields when lower/uppercasing a non-existant field
3
+
1
4
  ## 3.1.2
2
5
  - bugfix: split method was not working, #78
3
6
 
@@ -324,6 +324,7 @@ class LogStash::Filters::Mutate < LogStash::Filters::Base
324
324
  def uppercase(event)
325
325
  @uppercase.each do |field|
326
326
  original = event.get(field)
327
+ next if original.nil?
327
328
  # in certain cases JRuby returns a proxy wrapper of the event[field] value
328
329
  # therefore we can't assume that we are modifying the actual value behind
329
330
  # the key so read, modify and overwrite
@@ -349,6 +350,7 @@ class LogStash::Filters::Mutate < LogStash::Filters::Base
349
350
  #see comments for #uppercase
350
351
  @lowercase.each do |field|
351
352
  original = event.get(field)
353
+ next if original.nil?
352
354
  result = case original
353
355
  when Array
354
356
  original.map! do |elem|
@@ -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.2'
4
+ s.version = '3.1.3'
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"
@@ -72,6 +72,20 @@ describe LogStash::Filters::Mutate do
72
72
  end
73
73
  end
74
74
 
75
+ %w(lowercase uppercase).each do |operation|
76
+ context "executing #{operation} a non-existant field" do
77
+ let(:attrs) { }
78
+
79
+ let(:config) do
80
+ { operation => ["fake_field"] }
81
+ end
82
+
83
+ it "should not create that field" do
84
+ subject.filter(event)
85
+ expect(event).not_to include("fake_field")
86
+ end
87
+ end
88
+ end
75
89
  end
76
90
 
77
91
  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.2
4
+ version: 3.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-21 00:00:00.000000000 Z
11
+ date: 2016-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement