fluent-plugin-nais 0.17.0 → 0.18.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/fluent/plugin/filter_nais_logformat.rb +45 -41
 - data/lib/fluent/plugin/nais/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: f9395588b43c57ae5d342195e7bc5e9aa604cd04
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: a31f8e3b11a2b5e376a846dce8d406413856fe40
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 43d44fe4f9e443c3955de3806b395f4a491945445d48634cd6120043f3c05f8ffefc73d5f3da0afffed9b6ce1a2b07d58c725488bb6b95c0c686d8d075681812
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 78efb32a9e6b9c3fdbd7a35b4012bec3314d5d24960e99605d77f946a75132e5df429c42b49b9f4c9fe635694045ac76bbc84b058b5a8f66f78c5c850387d979
         
     | 
| 
         @@ -13,47 +13,52 @@ module Fluent::Plugin 
     | 
|
| 
       13 
13 
     | 
    
         
             
                def filter(tag, time, record)
         
     | 
| 
       14 
14 
     | 
    
         
             
                  r = nil
         
     | 
| 
       15 
15 
     | 
    
         
             
                  if record['kubernetes'].is_a?(Hash) && record['kubernetes']['annotations'].is_a?(Hash)
         
     | 
| 
       16 
     | 
    
         
            -
                     
     | 
| 
       17 
     | 
    
         
            -
                     
     | 
| 
       18 
     | 
    
         
            -
                       
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
      
 16 
     | 
    
         
            +
                    annotation = record['kubernetes']['annotations']['nais_io/logformat']
         
     | 
| 
      
 17 
     | 
    
         
            +
                    unless annotation.nil?
         
     | 
| 
      
 18 
     | 
    
         
            +
                      annotation.split(',').each {|fmt|
         
     | 
| 
      
 19 
     | 
    
         
            +
                        if fmt == 'accesslog'
         
     | 
| 
      
 20 
     | 
    
         
            +
                          r = ::Nais::Log::Parser.parse_accesslog(record['log'])
         
     | 
| 
      
 21 
     | 
    
         
            +
                          unless r.nil?
         
     | 
| 
      
 22 
     | 
    
         
            +
                            r = r[0]
         
     | 
| 
      
 23 
     | 
    
         
            +
                            r['log'] = r.delete('request')
         
     | 
| 
      
 24 
     | 
    
         
            +
                            level = ::Nais::Log::Parser.loglevel_from_http_response(r['response_code'])
         
     | 
| 
      
 25 
     | 
    
         
            +
                            r['level'] = level unless level.nil?
         
     | 
| 
      
 26 
     | 
    
         
            +
                          end
         
     | 
| 
      
 27 
     | 
    
         
            +
                        elsif fmt == 'accesslog_with_processing_time'
         
     | 
| 
      
 28 
     | 
    
         
            +
                          r = ::Nais::Log::Parser.parse_accesslog_with_processing_time(record['log'])
         
     | 
| 
      
 29 
     | 
    
         
            +
                          unless r.nil?
         
     | 
| 
      
 30 
     | 
    
         
            +
                            r['log'] = r.delete('request')
         
     | 
| 
      
 31 
     | 
    
         
            +
                            level = ::Nais::Log::Parser.loglevel_from_http_response(r['response_code'])
         
     | 
| 
      
 32 
     | 
    
         
            +
                            r['level'] = level unless level.nil?
         
     | 
| 
      
 33 
     | 
    
         
            +
                          end
         
     | 
| 
      
 34 
     | 
    
         
            +
                        elsif fmt == 'accesslog_with_referer_useragent'
         
     | 
| 
      
 35 
     | 
    
         
            +
                          r = ::Nais::Log::Parser.parse_accesslog_with_referer_useragent(record['log'])
         
     | 
| 
      
 36 
     | 
    
         
            +
                          unless r.nil?
         
     | 
| 
      
 37 
     | 
    
         
            +
                            r['log'] = r.delete('request')
         
     | 
| 
      
 38 
     | 
    
         
            +
                            level = ::Nais::Log::Parser.loglevel_from_http_response(r['response_code'])
         
     | 
| 
      
 39 
     | 
    
         
            +
                            r['level'] = level unless level.nil?
         
     | 
| 
      
 40 
     | 
    
         
            +
                          end
         
     | 
| 
      
 41 
     | 
    
         
            +
                        elsif fmt == 'glog'
         
     | 
| 
      
 42 
     | 
    
         
            +
                          r = ::Nais::Log::Parser.parse_glog(record['log'])
         
     | 
| 
      
 43 
     | 
    
         
            +
                          unless r.nil?
         
     | 
| 
      
 44 
     | 
    
         
            +
                            r['source'] = r['file']+':'+r.delete('line')
         
     | 
| 
      
 45 
     | 
    
         
            +
                            r['component'] = r.delete('file')
         
     | 
| 
      
 46 
     | 
    
         
            +
                            r['log'] = r.delete('message')
         
     | 
| 
      
 47 
     | 
    
         
            +
                          end
         
     | 
| 
      
 48 
     | 
    
         
            +
                        elsif fmt == 'influxdb'
         
     | 
| 
      
 49 
     | 
    
         
            +
                          r = ::Nais::Log::Parser.parse_influxdb(record['log'])
         
     | 
| 
      
 50 
     | 
    
         
            +
                          unless r.nil?
         
     | 
| 
      
 51 
     | 
    
         
            +
                            r['log'] = r.delete('message')
         
     | 
| 
      
 52 
     | 
    
         
            +
                            if r['component'] == 'httpd'
         
     | 
| 
      
 53 
     | 
    
         
            +
                              level = ::Nais::Log::Parser.loglevel_from_http_response(r['response_code'])
         
     | 
| 
      
 54 
     | 
    
         
            +
                              r['level'] = level unless level.nil?
         
     | 
| 
      
 55 
     | 
    
         
            +
                            end
         
     | 
| 
      
 56 
     | 
    
         
            +
                          end
         
     | 
| 
      
 57 
     | 
    
         
            +
                        elsif fmt == 'log15'
         
     | 
| 
      
 58 
     | 
    
         
            +
                          ::Nais::Log::Parser.remap_log15(record)
         
     | 
| 
       53 
59 
     | 
    
         
             
                        end
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
                      ::Nais::Log::Parser.remap_log15(record)
         
     | 
| 
      
 60 
     | 
    
         
            +
                        break unless r.nil?
         
     | 
| 
      
 61 
     | 
    
         
            +
                      }
         
     | 
| 
       57 
62 
     | 
    
         
             
                    end
         
     | 
| 
       58 
63 
     | 
    
         
             
                  end
         
     | 
| 
       59 
64 
     | 
    
         
             
                  if r.nil?
         
     | 
| 
         @@ -62,6 +67,5 @@ module Fluent::Plugin 
     | 
|
| 
       62 
67 
     | 
    
         
             
                    record.merge(r)
         
     | 
| 
       63 
68 
     | 
    
         
             
                  end
         
     | 
| 
       64 
69 
     | 
    
         
             
                end
         
     | 
| 
       65 
     | 
    
         
            -
                
         
     | 
| 
       66 
70 
     | 
    
         
             
              end
         
     | 
| 
       67 
71 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: fluent-plugin-nais
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.18.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Terje Sannum
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2017-11- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-11-28 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: fluentd
         
     |