fluent-plugin-nais 0.35.0 → 0.36.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: e8285beac37b5be2e03bdd10b7ccba5a81ae4e1e
4
- data.tar.gz: 0b09ea91a5172192060c2e2ad57738dc77ef8a52
3
+ metadata.gz: d011ea18c2cae66f5139d8c1adf827d24b368052
4
+ data.tar.gz: 935f0bb6a1da24ae45b26b809d60512038829527
5
5
  SHA512:
6
- metadata.gz: af7d3e5cd8e6086c45327c2d65b4a7395206c410ad07eea1ed00e5cd236e31c89ba5678fbc6592474adb7e01dad0e455c8984217e30f0d625906db007ad610f5
7
- data.tar.gz: b80c8dd3fc75455af5263f1ac4ecc3acb4eae665a536a7700540fa85de7f0018cec619f6dc1b736f67df078d4e9d258f1769b3781527183c3d95141322338d5f
6
+ metadata.gz: 3521542ac90b51bcdacc23e028ebf07e32a144096137e397cb08fb83044ad245d478292cac6ba69ef35da7d4d6a6842bdf177536d03211e00ac68389d46ed441
7
+ data.tar.gz: 9abd4476a218dbea14cc6de1ceb10b2c8718f64405cd66820fdf8d811c26cfe2f4634152775a64cdab6e5633eeecdcdaa6ec95cc5c9b02c94def2d0aa1124b64
@@ -6,6 +6,7 @@ module Fluent::Plugin
6
6
  class NaisLogformatFilter < Filter
7
7
  Fluent::Plugin.register_filter('nais_logformat', self)
8
8
  config_param :logformat, :string, default: ""
9
+ config_param :field, :string, default: "log"
9
10
 
10
11
  def configure(conf)
11
12
  super
@@ -20,74 +21,74 @@ module Fluent::Plugin
20
21
  unless formats.nil? || formats == ""
21
22
  formats.split(',').each {|fmt|
22
23
  if fmt == 'accesslog'
23
- r = ::Nais::Log::Parser.parse_accesslog(record['log'])
24
+ r = ::Nais::Log::Parser.parse_accesslog(record[@field])
24
25
  unless r.nil?
25
26
  r = r[0]
26
- r['log'] = r.delete('request')
27
+ r[@field] = r.delete('request')
27
28
  level = ::Nais::Log::Parser.loglevel_from_http_response(r['response_code'])
28
29
  r['level'] = level unless level.nil?
29
30
  end
30
31
  elsif fmt == 'accesslog_with_processing_time'
31
- r = ::Nais::Log::Parser.parse_accesslog_with_processing_time(record['log'])
32
+ r = ::Nais::Log::Parser.parse_accesslog_with_processing_time(record[@field])
32
33
  unless r.nil?
33
- r['log'] = r.delete('request')
34
+ r[@field] = r.delete('request')
34
35
  level = ::Nais::Log::Parser.loglevel_from_http_response(r['response_code'])
35
36
  r['level'] = level unless level.nil?
36
37
  end
37
38
  elsif fmt == 'accesslog_with_referer_useragent'
38
- r = ::Nais::Log::Parser.parse_accesslog_with_referer_useragent(record['log'])
39
+ r = ::Nais::Log::Parser.parse_accesslog_with_referer_useragent(record[@field])
39
40
  unless r.nil?
40
- r['log'] = r.delete('request')
41
+ r[@field] = r.delete('request')
41
42
  level = ::Nais::Log::Parser.loglevel_from_http_response(r['response_code'])
42
43
  r['level'] = level unless level.nil?
43
44
  end
44
45
  elsif fmt == 'capnslog'
45
- r = ::Nais::Log::Parser.parse_capnslog(record['log'])
46
+ r = ::Nais::Log::Parser.parse_capnslog(record[@field])
46
47
  unless r.nil?
47
- r['log'] = r.delete('message')
48
+ r[@field] = r.delete('message')
48
49
  end
49
50
  elsif fmt == 'logrus'
50
- r = ::Nais::Log::Parser.parse_logrus(record['log'])
51
+ r = ::Nais::Log::Parser.parse_logrus(record[@field])
51
52
  unless r.nil?
52
- r['log'] = r.delete('msg')
53
+ r[@field] = r.delete('msg')
53
54
  end
54
55
  elsif fmt == 'gokit'
55
- r = ::Nais::Log::Parser.parse_gokit(record['log'])
56
+ r = ::Nais::Log::Parser.parse_gokit(record[@field])
56
57
  unless r.nil?
57
58
  r['msg'] = r['err'] if r.has_key?('err') && !r.has_key?('msg')
58
- r['log'] = r.delete('msg')
59
+ r[@field] = r.delete('msg')
59
60
  end
60
61
  elsif fmt == 'rook'
61
- r = ::Nais::Log::Parser.parse_rook(record['log'])
62
+ r = ::Nais::Log::Parser.parse_rook(record[@field])
62
63
  unless r.nil?
63
- r['log'] = r.delete('message')
64
+ r[@field] = r.delete('message')
64
65
  end
65
66
  elsif fmt == 'redis'
66
- r = ::Nais::Log::Parser.parse_redis(record['log'])
67
+ r = ::Nais::Log::Parser.parse_redis(record[@field])
67
68
  unless r.nil?
68
- r['log'] = r.delete('message')
69
+ r[@field] = r.delete('message')
69
70
  end
70
71
  elsif fmt == 'coredns'
71
- r = ::Nais::Log::Parser.parse_coredns(record['log'])
72
+ r = ::Nais::Log::Parser.parse_coredns(record[@field])
72
73
  unless r.nil?
73
- r['log'] = r.delete('message')
74
+ r[@field] = r.delete('message')
74
75
  end
75
76
  elsif fmt == 'simple'
76
- r = ::Nais::Log::Parser.parse_simple(record['log'])
77
+ r = ::Nais::Log::Parser.parse_simple(record[@field])
77
78
  unless r.nil?
78
- r['log'] = r.delete('message')
79
+ r[@field] = r.delete('message')
79
80
  end
80
81
  elsif fmt == 'glog'
81
- r = ::Nais::Log::Parser.parse_glog(record['log'])
82
+ r = ::Nais::Log::Parser.parse_glog(record[@field])
82
83
  unless r.nil?
83
84
  r['source'] = r['file']+':'+r.delete('line')
84
85
  r['component'] = r.delete('file')
85
- r['log'] = r.delete('message')
86
+ r[@field] = r.delete('message')
86
87
  end
87
88
  elsif fmt == 'influxdb'
88
- r = ::Nais::Log::Parser.parse_influxdb(record['log'])
89
+ r = ::Nais::Log::Parser.parse_influxdb(record[@field])
89
90
  unless r.nil?
90
- r['log'] = r.delete('message')
91
+ r[@field] = r.delete('message')
91
92
  if r['component'] == 'httpd'
92
93
  level = ::Nais::Log::Parser.loglevel_from_http_response(r['response_code'])
93
94
  r['level'] = level unless level.nil?
@@ -1,7 +1,7 @@
1
1
  module Fluent
2
2
  module Plugin
3
3
  module Nais
4
- VERSION = "0.35.0"
4
+ VERSION = "0.36.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.35.0
4
+ version: 0.36.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: 2019-01-22 00:00:00.000000000 Z
11
+ date: 2019-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd