fluent-plugin-nais 0.29.0 → 0.30.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fluent-plugin-nais.gemspec +1 -1
- data/lib/fluent/plugin/filter_nais_logformat.rb +71 -64
- data/lib/fluent/plugin/nais/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '088d42902132a64e080f5892e045e26408b344d6'
|
4
|
+
data.tar.gz: a1edd1c16515fa778d510d49b9928597133f73eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b332324a0f4ff4c7e0672d6f99782a97bec7084c3c68f854e9c3358953755e7e8f5c3970640afabac518011f684b87f3e2fc5568b6b075e8f71d335f36b856c4
|
7
|
+
data.tar.gz: 3a0bbe8fcc1e99ac1eae855b20066ff71587157c24dc25b2a67e1322a3f3be3e315fd9520ebf97125c78128195ef6322eb9eab0e2d55acfcd808e478bd68a3ee
|
data/fluent-plugin-nais.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
23
|
spec.add_dependency 'fluentd', '~> 1.1'
|
24
|
-
spec.add_dependency 'nais-log-parser', '>= 0.
|
24
|
+
spec.add_dependency 'nais-log-parser', '>= 0.30.0'
|
25
25
|
|
26
26
|
spec.add_development_dependency "bundler", "~> 1.15"
|
27
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -5,6 +5,7 @@ require 'nais/log/parser'
|
|
5
5
|
module Fluent::Plugin
|
6
6
|
class NaisLogformatFilter < Filter
|
7
7
|
Fluent::Plugin.register_filter('nais_logformat', self)
|
8
|
+
config_param :logformat, :string, default: ""
|
8
9
|
|
9
10
|
def configure(conf)
|
10
11
|
super
|
@@ -12,75 +13,81 @@ module Fluent::Plugin
|
|
12
13
|
|
13
14
|
def filter(tag, time, record)
|
14
15
|
r = nil
|
16
|
+
formats = @logformat
|
15
17
|
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
|
-
|
18
|
+
formats = record['kubernetes']['annotations']['nais_io/logformat']
|
19
|
+
end
|
20
|
+
unless formats.nil? || formats == ""
|
21
|
+
formats.split(',').each {|fmt|
|
22
|
+
if fmt == 'accesslog'
|
23
|
+
r = ::Nais::Log::Parser.parse_accesslog(record['log'])
|
24
|
+
unless r.nil?
|
25
|
+
r = r[0]
|
26
|
+
r['log'] = r.delete('request')
|
27
|
+
level = ::Nais::Log::Parser.loglevel_from_http_response(r['response_code'])
|
28
|
+
r['level'] = level unless level.nil?
|
29
|
+
end
|
30
|
+
elsif fmt == 'accesslog_with_processing_time'
|
31
|
+
r = ::Nais::Log::Parser.parse_accesslog_with_processing_time(record['log'])
|
32
|
+
unless r.nil?
|
33
|
+
r['log'] = r.delete('request')
|
34
|
+
level = ::Nais::Log::Parser.loglevel_from_http_response(r['response_code'])
|
35
|
+
r['level'] = level unless level.nil?
|
36
|
+
end
|
37
|
+
elsif fmt == 'accesslog_with_referer_useragent'
|
38
|
+
r = ::Nais::Log::Parser.parse_accesslog_with_referer_useragent(record['log'])
|
39
|
+
unless r.nil?
|
40
|
+
r['log'] = r.delete('request')
|
41
|
+
level = ::Nais::Log::Parser.loglevel_from_http_response(r['response_code'])
|
42
|
+
r['level'] = level unless level.nil?
|
43
|
+
end
|
44
|
+
elsif fmt == 'capnslog'
|
45
|
+
r = ::Nais::Log::Parser.parse_capnslog(record['log'])
|
46
|
+
unless r.nil?
|
47
|
+
r['log'] = r.delete('message')
|
48
|
+
end
|
49
|
+
elsif fmt == 'logrus'
|
50
|
+
r = ::Nais::Log::Parser.parse_logrus(record['log'])
|
51
|
+
unless r.nil?
|
52
|
+
r['log'] = r.delete('msg')
|
53
|
+
end
|
54
|
+
elsif fmt == 'gokit'
|
55
|
+
r = ::Nais::Log::Parser.parse_gokit(record['log'])
|
56
|
+
unless r.nil?
|
57
|
+
r['msg'] = r['err'] if r.has_key?('err') && !r.has_key?('msg')
|
58
|
+
r['log'] = r.delete('msg')
|
59
|
+
end
|
60
|
+
elsif fmt == 'redis'
|
61
|
+
r = ::Nais::Log::Parser.parse_redis(record['log'])
|
62
|
+
unless r.nil?
|
63
|
+
r['log'] = r.delete('message')
|
64
|
+
end
|
65
|
+
elsif fmt == 'simple'
|
66
|
+
r = ::Nais::Log::Parser.parse_simple(record['log'])
|
67
|
+
unless r.nil?
|
68
|
+
r['log'] = r.delete('message')
|
69
|
+
end
|
70
|
+
elsif fmt == 'glog'
|
71
|
+
r = ::Nais::Log::Parser.parse_glog(record['log'])
|
72
|
+
unless r.nil?
|
73
|
+
r['source'] = r['file']+':'+r.delete('line')
|
74
|
+
r['component'] = r.delete('file')
|
75
|
+
r['log'] = r.delete('message')
|
76
|
+
end
|
77
|
+
elsif fmt == 'influxdb'
|
78
|
+
r = ::Nais::Log::Parser.parse_influxdb(record['log'])
|
79
|
+
unless r.nil?
|
80
|
+
r['log'] = r.delete('message')
|
81
|
+
if r['component'] == 'httpd'
|
38
82
|
level = ::Nais::Log::Parser.loglevel_from_http_response(r['response_code'])
|
39
83
|
r['level'] = level unless level.nil?
|
40
84
|
end
|
41
|
-
elsif fmt == 'capnslog'
|
42
|
-
r = ::Nais::Log::Parser.parse_capnslog(record['log'])
|
43
|
-
unless r.nil?
|
44
|
-
r['log'] = r.delete('message')
|
45
|
-
end
|
46
|
-
elsif fmt == 'logrus'
|
47
|
-
r = ::Nais::Log::Parser.parse_logrus(record['log'])
|
48
|
-
unless r.nil?
|
49
|
-
r['log'] = r.delete('msg')
|
50
|
-
end
|
51
|
-
elsif fmt == 'gokit'
|
52
|
-
r = ::Nais::Log::Parser.parse_gokit(record['log'])
|
53
|
-
unless r.nil?
|
54
|
-
r['msg'] = r['err'] if r.has_key?('err') && !r.has_key?('msg')
|
55
|
-
r['log'] = r.delete('msg')
|
56
|
-
end
|
57
|
-
elsif fmt == 'simple'
|
58
|
-
r = ::Nais::Log::Parser.parse_simple(record['log'])
|
59
|
-
unless r.nil?
|
60
|
-
r['log'] = r.delete('message')
|
61
|
-
end
|
62
|
-
elsif fmt == 'glog'
|
63
|
-
r = ::Nais::Log::Parser.parse_glog(record['log'])
|
64
|
-
unless r.nil?
|
65
|
-
r['source'] = r['file']+':'+r.delete('line')
|
66
|
-
r['component'] = r.delete('file')
|
67
|
-
r['log'] = r.delete('message')
|
68
|
-
end
|
69
|
-
elsif fmt == 'influxdb'
|
70
|
-
r = ::Nais::Log::Parser.parse_influxdb(record['log'])
|
71
|
-
unless r.nil?
|
72
|
-
r['log'] = r.delete('message')
|
73
|
-
if r['component'] == 'httpd'
|
74
|
-
level = ::Nais::Log::Parser.loglevel_from_http_response(r['response_code'])
|
75
|
-
r['level'] = level unless level.nil?
|
76
|
-
end
|
77
|
-
end
|
78
|
-
elsif fmt == 'log15'
|
79
|
-
::Nais::Log::Parser.remap_log15(record)
|
80
85
|
end
|
81
|
-
|
82
|
-
|
83
|
-
|
86
|
+
elsif fmt == 'log15'
|
87
|
+
::Nais::Log::Parser.remap_log15(record)
|
88
|
+
end
|
89
|
+
break unless r.nil?
|
90
|
+
}
|
84
91
|
end
|
85
92
|
if r.nil?
|
86
93
|
record
|
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.30.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: 2018-08-
|
11
|
+
date: 2018-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.30.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.30.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|