13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/fluent/plugin/filter_nais_logtransform.rb', line 13
def filter(tag, time, record)
if record['kubernetes'].is_a?(Hash) && record['kubernetes']['annotations'].is_a?(Hash)
transformers = record['kubernetes']['annotations']['nais_io/logtransform']
unless transformers.nil?
transformers.split(/ *, */).each { |t|
if t == 'dns_loglevel'
level = ::Nais::Log::Parser.loglevel_from_dns_response(record['response_code'])
record['level'] = level unless level.nil?
elsif t == 'http_loglevel'
level = ::Nais::Log::Parser.loglevel_from_http_response(record['response_code'])
record['level'] = level unless level.nil?
end
}
end
end
record
end
|