fluent-plugin-nais 0.9.0 → 0.10.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: 52ee1dfd02d686dec82f927d90333c1a52cff76c
4
- data.tar.gz: 5c160f964bf12372b7a80b48591e28771bf114ac
3
+ metadata.gz: cafcdba13c9cd44153ba0cb060036f6b2c3e9bf9
4
+ data.tar.gz: 1d95d13447c82d98a11a3c3f74ccb499871d15e5
5
5
  SHA512:
6
- metadata.gz: 19f4110b62c360d3f1ccf608cca8620746920c70c94042d5ecaefc0f6a8b85cdd44428c7e27f74248f3c1905c6891104c452117d0bee12986621d57ad8e63eed
7
- data.tar.gz: b6c72c7af749da8fb0ebc1a2165bee1c072c16ac421055b3f7d0066e67b49e991df8c3ca11cdd730007a6091814d4a34ccddbef1403a68a425716a067f6488ee
6
+ metadata.gz: 0ee8c9fdddfdf4e9f52ce0fe07fd86022fece2d87e64b355bacb313370c75361480e43783790d9e90b8fcb3c8850f2fa0cac398acefe5cc0e054231f15be9724
7
+ data.tar.gz: c5e7f180fe46f332f6e61f98213df5e54db4ce298617b04a7648fdff9da6e40e0dc6507c0109ee08e56f660d33a68fad4da1e3a49be69687cc682d372b0f6430
@@ -19,10 +19,14 @@ module Fluent::Plugin
19
19
  unless r.nil?
20
20
  r = r[0]
21
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?
22
24
  end
23
25
  elsif fmt == 'accesslog_with_processing_time'
24
26
  r = ::Nais::Log::Parser.parse_accesslog_with_processing_time(record['log'])
25
27
  r['log'] = r.delete('request') unless r.nil?
28
+ level = ::Nais::Log::Parser.loglevel_from_http_response(r['response_code'])
29
+ r['level'] = level unless level.nil?
26
30
  elsif fmt == 'glog'
27
31
  r = ::Nais::Log::Parser.parse_glog(record['log'])
28
32
  unless r.nil?
@@ -36,6 +40,8 @@ module Fluent::Plugin
36
40
  if r['component'] == 'httpd'
37
41
  r['log'] = r.delete('request')
38
42
  r['request'] = r.delete('request_id')
43
+ level = ::Nais::Log::Parser.loglevel_from_http_response(r['response_code'])
44
+ r['level'] = level unless level.nil?
39
45
  else
40
46
  if r.has_key?('timestamp')
41
47
  r['log'] = record['log'].sub(/^\S+ \S+ \S+ /, '')
@@ -0,0 +1,32 @@
1
+ require "fluent/plugin/nais/version"
2
+ require 'fluent/plugin/filter'
3
+ require 'nais/log/parser'
4
+
5
+ module Fluent::Plugin
6
+ class NaisLogtransformFilter < Filter
7
+ Fluent::Plugin.register_filter('nais_logtransform', self)
8
+
9
+ def configure(conf)
10
+ super
11
+ end
12
+
13
+ def filter(tag, time, record)
14
+ r = nil
15
+ if record['kubernetes'].is_a?(Hash) && record['kubernetes']['annotations'].is_a?(Hash)
16
+ transformers = record['kubernetes']['annotations']['nais_io/logtransform']
17
+ unless transformers.nil?
18
+ transformer.split(/ *, */).each { |t|
19
+ if t == 'dns_loglevel'
20
+ r = ::Nais::Log::Parser.loglevel_from_dns_response(record['response_code'])
21
+ record['level'] = r unless r.nil?
22
+ elsif t == 'http_loglevel'
23
+ r = ::Nais::Log::Parser.loglevel_from_http_response(record['response_code'])
24
+ record['level'] = r unless r.nil?
25
+ end
26
+ }
27
+ end
28
+ end
29
+ end
30
+
31
+ end
32
+ end
@@ -1,7 +1,7 @@
1
1
  module Fluent
2
2
  module Plugin
3
3
  module Nais
4
- VERSION = "0.9.0"
4
+ VERSION = "0.10.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.9.0
4
+ version: 0.10.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-10-04 00:00:00.000000000 Z
11
+ date: 2017-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -100,6 +100,7 @@ files:
100
100
  - lib/fluent/plugin/filter_nais_exceptions.rb
101
101
  - lib/fluent/plugin/filter_nais_flatten_record.rb
102
102
  - lib/fluent/plugin/filter_nais_logformat.rb
103
+ - lib/fluent/plugin/filter_nais_logtransform.rb
103
104
  - lib/fluent/plugin/filter_nais_prefix_fields.rb
104
105
  - lib/fluent/plugin/filter_nais_remap_elasticsearch.rb
105
106
  - lib/fluent/plugin/filter_nais_remap_java.rb