fluent-plugin-maskrx 0.0.1.beta6 → 0.0.1.beta7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/filter-plugin-maskrx.gemspec +1 -1
- data/lib/fluent/plugin/filter_maskrx.rb +25 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f4d9adc48590e5e99a1d09210b1dee00b94cd763e5b910a59562c05e669aa59
|
4
|
+
data.tar.gz: ee16da1ce58adb70af2bb3911036cd9da645ce01ed666c1cef75ce23182d9777
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e8decbc5ddd8e693b64cd9240ec55454d4a91f32c9e57f41c7429f98cba82ab6cc9ec46fa8f34d96d78be5bbbc71ea879690f27d308b604f2d15bc5696e2c47
|
7
|
+
data.tar.gz: 3f3ecf0fd62724b2e70fa7489503b2bf2da762b79efeac3777689ff31850c1bb03c1933e4798b9aad68d224ca7fa8c40f04a2d44f93a35ef4b50172b5ecd9c8b
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "fluent-plugin-maskrx"
|
7
|
-
spec.version = "0.0.1.
|
7
|
+
spec.version = "0.0.1.beta7"
|
8
8
|
spec.authors = ["Joshua Mervine"]
|
9
9
|
spec.email = ["joshua@mervine.net"]
|
10
10
|
spec.summary = %q{Fluentd filter plugin to mask strings within records.}
|
@@ -30,17 +30,37 @@ module Fluent::Plugin
|
|
30
30
|
def filter(_, _, record)
|
31
31
|
log.debug("plugin=maskrx at=filter record=\"#{record}\"")
|
32
32
|
|
33
|
+
mask_record(config, record)
|
34
|
+
end
|
35
|
+
|
36
|
+
def filter_stream(tag, es)
|
37
|
+
new_es = Fluent::MultiEventStream.new
|
38
|
+
es.each do |time, record|
|
39
|
+
log.debug("plugin=maskrx at=filter_stream record=\"#{record}\"")
|
40
|
+
|
41
|
+
new_es.add(time, mask_record(record))
|
42
|
+
end
|
43
|
+
|
44
|
+
new_es
|
45
|
+
end
|
46
|
+
|
47
|
+
protected
|
48
|
+
def mask_record(record)
|
33
49
|
@mask_config_list.each do |config|
|
34
|
-
record =
|
50
|
+
record = mask_entry(config, record)
|
35
51
|
end
|
36
52
|
|
37
53
|
record
|
38
54
|
end
|
39
55
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
56
|
+
def mask_entry(config, record)
|
57
|
+
keys = if config.keys.nil? || config.keys.empty?
|
58
|
+
record.keys
|
59
|
+
else
|
60
|
+
config.keys
|
61
|
+
end
|
62
|
+
|
63
|
+
log.debug("plugin=maskrx at=mask_entry keys=\"#{keys}\"")
|
44
64
|
|
45
65
|
keys.each do |key|
|
46
66
|
record[key] = mask_key_value(config.pattern, config.mask, record[key]) unless record[key].nil?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-maskrx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.beta7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Mervine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|