logstash-filter-rmf 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/logstash/filters/rmf.rb +26 -1
 - data/logstash-filter-rmf.gemspec +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: bde95ab98819542a24bbe5e0074187ff882e4dd54dd2219586ec01a16cf0da79
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 9044d1b00679433f7cbdc05b2ae97676175265418b572633f229a31139576608
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 21f4dc2cda7236a2bcc039bb899349bd5cdd4fdf7fa1d8715288bca31a2d7be34117edb9b2219b47f9b015f7fae64ceba16499a9ef122b9a4c8d3d00552145fc
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 80556a4fefe8675e5cfc3b14e75e2617b7cb69ab6f72f1d1e4235538cfafc6b143f7973bdf33c49581f2da8d30b9bb56967a5b9f11d69e7426aae05b7e006543
         
     | 
    
        data/lib/logstash/filters/rmf.rb
    CHANGED
    
    | 
         @@ -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?( 
     | 
| 
      
 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
         
     | 
    
        data/logstash-filter-rmf.gemspec
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       2 
2 
     | 
    
         
             
              s.name          = 'logstash-filter-rmf'
         
     | 
| 
       3 
     | 
    
         
            -
              s.version       = '1.0 
     | 
| 
      
 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.'
         
     |