logstash-filter-remove_key_pattern 0.1.0 → 0.1.1

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: fdea4c729036149c31577a3da38c119fcbd32412
4
- data.tar.gz: 53598fbdb3513c2f009bd1b5ff6311d1e9daf5e9
3
+ metadata.gz: 88b15b62e5711f4342a5c9d56c04bd43f5c9330d
4
+ data.tar.gz: 8a0f733a8a87d8755da3e3118f42b28e23c53240
5
5
  SHA512:
6
- metadata.gz: 7b22d733cc9eb7bf767b179f93ae1cb36ebdcf90fef91fae0d3ba70f5a4851b227841d0c338c5c34383de0616a2cd2ec8c6838247e5dcb65710c976b943f6505
7
- data.tar.gz: 445d1b9a17298e4fccc6b516bdc29f806d38954fcd1528dc866abb0acd231f3c2374d74726b3cef91c82d7dcc4da570a7ff3fbabd3bb11fe20eae8c25adfc845
6
+ metadata.gz: ec689164eacf6b3bd47b57bc4d7059ed9c8b670e6b33c137c5ef49e61d508737f472076825536a2d0ff5b87b8db7994d24c0cbd53ecc57b7e980cc237cb948fa
7
+ data.tar.gz: fcf19e4cf15be9fccaf547888e41acd010dfba9d7f3697e70845a08f9967bb362594e13f55bb1b852d8f342ae936cdcf2c21d41108a2ca8454fa58fe5db2864c
@@ -42,6 +42,7 @@ class LogStash::Filters::RemoveKeyPattern < LogStash::Filters::Base
42
42
 
43
43
  public
44
44
  def filter(event)
45
+ File.open('/tmp/logstash_events.txt', 'w+') { |file| file << event }
45
46
  @parent_keys.each do |key|
46
47
  remove_pattern(event, key) unless event.get(key).nil?
47
48
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-filter-remove_key_pattern'
3
- s.version = '0.1.0'
3
+ s.version = '0.1.1'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = 'Remove all keys that match pattern'
6
6
  s.authors = ['Arthur Alfredo']
@@ -92,7 +92,51 @@ describe LogStash::Filters::RemoveKeyPattern do
92
92
  insist { subject.get("haystack2") }.include?("key")
93
93
  insist { subject.get("haystack2") }.include?("foobar")
94
94
  end
95
+ end
96
+
97
+ describe "try to remove a pattern from unexisting parent keys" do
98
+ config <<-CONFIG
99
+ filter {
100
+ remove_key_pattern {
101
+ parent_keys => ["h2", "h1"]
102
+ pattern => ["needle", "\\d"]
103
+ keep_only_ids => "true"
104
+ }
105
+ }
106
+ CONFIG
107
+
108
+ hash = {
109
+ "hello" => {
110
+ "numbers" => ["one", "two", "three"],
111
+ "47" => ["2", "3", "7"],
112
+ },
113
+ "haystack" => {
114
+ "key1_id" => ["value1", "value2", "value3"],
115
+ "id" => ["value1", "value2", "value3"],
116
+ "key4_id" => ["value1", "value2", "value3"],
117
+ "key_four_id" => ["value1", "value2", "value3"],
118
+ "needle" => ["value1", "value2", "value3"],
119
+ },
120
+ "haystack2" => {
121
+ "key_one_id" => ["value1", "value2", "value3"],
122
+ "id" => ["value1", "value2", "value3"],
123
+ "key4_id" => ["value1", "value2", "value3"],
124
+ "key" => ["value1", "value2", "value3"],
125
+ "foobar" => ["value1", "value2", "value3"],
126
+ }
127
+ }
95
128
 
129
+ sample(hash) do
130
+ insist { subject.get("hello") }.include?("numbers")
131
+ insist { subject.get("haystack") }.include?("id")
132
+ insist { subject.get("haystack") }.include?("key_four_id")
133
+ insist { subject.get("haystack") }.include?("key4_id")
134
+ insist { subject.get("haystack2") }.include?("key_one_id")
135
+ insist { subject.get("haystack2") }.include?("key4_id")
136
+ insist { subject.get("haystack2") }.include?("key")
137
+ insist { subject.get("haystack2") }.include?("foobar")
138
+ end
96
139
  end
97
140
 
141
+
98
142
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-remove_key_pattern
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
  - Arthur Alfredo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-01 00:00:00.000000000 Z
11
+ date: 2017-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement