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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88b15b62e5711f4342a5c9d56c04bd43f5c9330d
|
4
|
+
data.tar.gz: 8a0f733a8a87d8755da3e3118f42b28e23c53240
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
@@ -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.
|
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-
|
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
|