logstash-filter-rmf 1.0.2 → 1.1.0

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
  SHA256:
3
- metadata.gz: 7ddb2d2d0474922e31c7a6f6cafa5c9c37eeb7320032444ae105927c262f189f
4
- data.tar.gz: bd4d4eb4883720a40b0258d3229e82b4ac413b3386186e6e4b16a8a0b6542152
3
+ metadata.gz: bde95ab98819542a24bbe5e0074187ff882e4dd54dd2219586ec01a16cf0da79
4
+ data.tar.gz: 9044d1b00679433f7cbdc05b2ae97676175265418b572633f229a31139576608
5
5
  SHA512:
6
- metadata.gz: 207fc142e62eb7c87aa78ae4fae2c75512ae6a7aa8ef55e48b93fa92db8c6e3d0c65003e72d3f6c5b4248f150fe9647ed8035a1902fe25b5acdba275e882582f
7
- data.tar.gz: 50c07eb39af19937caebf9151da4a023a6bbbd97f4865db789528ce9e69f5a32c9aa2f8b04d804aca94dff52db151caa4abb4c816dc66dddbcdafbde180689d8
6
+ metadata.gz: 21f4dc2cda7236a2bcc039bb899349bd5cdd4fdf7fa1d8715288bca31a2d7be34117edb9b2219b47f9b015f7fae64ceba16499a9ef122b9a4c8d3d00552145fc
7
+ data.tar.gz: 80556a4fefe8675e5cfc3b14e75e2617b7cb69ab6f72f1d1e4235538cfafc6b143f7973bdf33c49581f2da8d30b9bb56967a5b9f11d69e7426aae05b7e006543
@@ -14,7 +14,7 @@ class LogStash::Filters::Rmf < LogStash::Filters::Base
14
14
  # set whitelist to an array of arrays each element of those are field
15
15
  # for example if we had ["a.a.a", "[b][c]"] we'll have [["a","a","a"]["b","c"]]
16
16
  @whitelist.map! {
17
- |item| item.include?('[') ? item.split('][') : item.split('.')
17
+ |item| item.include?(".") ? item.split(".") : item.split("][")
18
18
  }
19
19
  @whitelist.each do |item|
20
20
  if item.kind_of?(Array)
@@ -24,6 +24,31 @@ class LogStash::Filters::Rmf < LogStash::Filters::Base
24
24
  if item[-1].include? ']'
25
25
  item[-1]=item[-1][0..-2]
26
26
  end
27
+ item.each_with_index do |_, j|
28
+ make_level j
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ def make_level(level)
35
+ @whitelist.each_with_index do |item, i|
36
+ if item.kind_of?(Array)
37
+ if item[level] != nil && item[level].include?('|')
38
+ if item[level][0] == '(' || item[level][0] == '['
39
+ item[level] = item[level][1..-2]
40
+ end
41
+ item[level].split('|').each do |el|
42
+ if level == 0
43
+ @whitelist += [[el] + item[1..-1]]
44
+ elsif @whitelist[i].length >= level+1
45
+ @whitelist += [item[0..level-1] + [el] + item[level+1..-1]]
46
+ else
47
+ @whitelist += [item[i][0..level-1] + [el]]
48
+ end
49
+ end
50
+ @whitelist.delete(item)
51
+ end
27
52
  end
28
53
  end
29
54
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-filter-rmf'
3
- s.version = '1.0.2'
3
+ s.version = '1.1.0'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = 'Allows to remove not whitelisted fields.'
6
6
  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.'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-rmf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - vovnit-phie