fluent-plugin-nais 0.17.0 → 0.18.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
  SHA1:
3
- metadata.gz: 5627059538ead54ddd985dd312c7e064a303797f
4
- data.tar.gz: 770e069bf9364d43afb30bed81b378e04639fafe
3
+ metadata.gz: f9395588b43c57ae5d342195e7bc5e9aa604cd04
4
+ data.tar.gz: a31f8e3b11a2b5e376a846dce8d406413856fe40
5
5
  SHA512:
6
- metadata.gz: 63771d71fb94a791e5720bc5fd5ddcb8d6f353cb7d8a60a93c7ad5d94b34d1320fcd8442c84d1052e49709360c624ed80d75a0f4e7eb1b65dc73d2f5fb271d6d
7
- data.tar.gz: 8807a807b02266775cbc80c29c93790e1c5d7f5c60afb0d928479023933b347e6cff8b87cdcb614e05028f26f71b855a9703e97ec98da0eded699769535fca73
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
- fmt = record['kubernetes']['annotations']['nais_io/logformat']
17
- if fmt == 'accesslog'
18
- r = ::Nais::Log::Parser.parse_accesslog(record['log'])
19
- unless r.nil?
20
- r = r[0]
21
- r['log'] = r.delete('request')
22
- level = ::Nais::Log::Parser.loglevel_from_http_response(r['response_code'])
23
- r['level'] = level unless level.nil?
24
- end
25
- elsif fmt == 'accesslog_with_processing_time'
26
- r = ::Nais::Log::Parser.parse_accesslog_with_processing_time(record['log'])
27
- unless r.nil?
28
- r['log'] = r.delete('request')
29
- level = ::Nais::Log::Parser.loglevel_from_http_response(r['response_code'])
30
- r['level'] = level unless level.nil?
31
- end
32
- elsif fmt == 'accesslog_with_referer_useragent'
33
- r = ::Nais::Log::Parser.parse_accesslog_with_referer_useragent(record['log'])
34
- unless r.nil?
35
- r['log'] = r.delete('request')
36
- level = ::Nais::Log::Parser.loglevel_from_http_response(r['response_code'])
37
- r['level'] = level unless level.nil?
38
- end
39
- elsif fmt == 'glog'
40
- r = ::Nais::Log::Parser.parse_glog(record['log'])
41
- unless r.nil?
42
- r['source'] = r['file']+':'+r.delete('line')
43
- r['component'] = r.delete('file')
44
- r['log'] = r.delete('message')
45
- end
46
- elsif fmt == 'influxdb'
47
- r = ::Nais::Log::Parser.parse_influxdb(record['log'])
48
- unless r.nil?
49
- r['log'] = r.delete('message')
50
- if r['component'] == 'httpd'
51
- level = ::Nais::Log::Parser.loglevel_from_http_response(r['response_code'])
52
- r['level'] = level unless level.nil?
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
- end
55
- elsif fmt == 'log15'
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
@@ -1,7 +1,7 @@
1
1
  module Fluent
2
2
  module Plugin
3
3
  module Nais
4
- VERSION = "0.17.0"
4
+ VERSION = "0.18.0"
5
5
  end
6
6
  end
7
7
  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.17.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-21 00:00:00.000000000 Z
11
+ date: 2017-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd