fluent-plugin-nais 0.24.0 → 0.25.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c8b1bbfea21d0cfb5e2dead45ffcdec6ceb2ef4
|
4
|
+
data.tar.gz: '089fe10867da708cd1f9f5e21bb6d566412b4e99'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c5ed03576b7bdea6ddbae2fc08af3f0d3a95e07415e5401fdf106005871967fa99d6757734f9e7a689585156b76b19c9667047386bea76460a6b0d176f74bc8
|
7
|
+
data.tar.gz: '009e6e30e4e613aa3967fadee16104d0d31f9f63491a9299ea2535acc157845bf59bd431f01316241835b5305bdd38a9a635c69ee297be9f18f618d0b8663c77'
|
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.26.0'
|
25
25
|
|
26
26
|
spec.add_development_dependency "bundler", "~> 1.15"
|
27
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -5,13 +5,15 @@ require 'nais/log/parser'
|
|
5
5
|
module Fluent::Plugin
|
6
6
|
class NaisFlattenFilter < Filter
|
7
7
|
Fluent::Plugin.register_filter('nais_flatten_record', self)
|
8
|
-
|
8
|
+
config_param :keep, :string, default: ""
|
9
|
+
|
9
10
|
def configure(conf)
|
10
11
|
super
|
12
|
+
@re = @keep == "" ? nil : Regexp.new(@keep)
|
11
13
|
end
|
12
14
|
|
13
15
|
def filter(tag, time, record)
|
14
|
-
::Nais::Log::Parser.flatten_hash(record)
|
16
|
+
::Nais::Log::Parser.flatten_hash(record, "", @re)
|
15
17
|
end
|
16
18
|
|
17
19
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require "fluent/plugin/nais/version"
|
2
2
|
require 'fluent/plugin/filter'
|
3
|
+
require 'nais/log/parser'
|
3
4
|
|
4
5
|
module Fluent
|
5
6
|
module Plugin
|
@@ -12,7 +13,7 @@ module Fluent
|
|
12
13
|
record['level'] = 'Audit'
|
13
14
|
if record.has_key?('user')
|
14
15
|
if record['user'].has_key?('username')
|
15
|
-
if m = record['user']['username'].match(/^https:\/\/sts\.windows\.net.*\#(
|
16
|
+
if m = record['user']['username'].match(/^https:\/\/sts\.windows\.net.*\#(.+)/)
|
16
17
|
record['x_username'] = record['user']['username']
|
17
18
|
record['user'] = m[1]
|
18
19
|
else
|
@@ -22,7 +23,16 @@ module Fluent
|
|
22
23
|
end
|
23
24
|
record['method'] = record.delete('verb') if record.has_key?('verb')
|
24
25
|
record['uri'] = record.delete('requestURI') if record.has_key?('requestURI')
|
25
|
-
record
|
26
|
+
record.merge!(::Nais::Log::Parser.parse_uri(record['uri']))
|
27
|
+
if record.has_key?('sourceIPs')
|
28
|
+
ips = record['sourceIPs'].is_a?(Array) ? record['sourceIPs'] : [ record['sourceIPs'] ]
|
29
|
+
ok = true
|
30
|
+
ips.each{|ip|
|
31
|
+
ok = (ip.is_a?(String) && ip =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/ ? true : false)
|
32
|
+
break unless ok
|
33
|
+
}
|
34
|
+
record['remote_ip'] = record.delete('sourceIPs') if ok
|
35
|
+
end
|
26
36
|
record['@timestamp'] = record.delete('stageTimestamp') if record.has_key?('stageTimestamp')
|
27
37
|
record.delete('apiVersion')
|
28
38
|
record['message'] = record['method'] + ' ' + record['uri'] unless record.has_key?('message')
|
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.25.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-06-
|
11
|
+
date: 2018-06-14 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.26.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.26.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|