fluent-plugin-maskrx 0.0.1.beta3 → 0.0.1.beta7

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
  SHA256:
3
- metadata.gz: b6dc9dd484960f4efcb80a2a28c4a0873ecf43f96781803c0f83a680111e51a5
4
- data.tar.gz: 5aa7a979394892af8a96b2070cf67c1c59879361616097c9c12ef3bba0ecb539
3
+ metadata.gz: 2f4d9adc48590e5e99a1d09210b1dee00b94cd763e5b910a59562c05e669aa59
4
+ data.tar.gz: ee16da1ce58adb70af2bb3911036cd9da645ce01ed666c1cef75ce23182d9777
5
5
  SHA512:
6
- metadata.gz: a827c95272e29ac16ccb23424d96b0bbb1d8fd0f0c6ff8e2389f2b9f8e97aba15411ed3d8dcab2389b24a97ae30ac4d5160709f3d3f49b87449514fcd275b9d1
7
- data.tar.gz: 70006931416eda376071bdc6add53043b9531e0fd197ead6946a644d4658567b9e26f1c5deaad7b4c173958614a95db0c36380d3355866aece2a526b6ac569f2
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.beta3"
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.}
@@ -17,25 +17,50 @@ module Fluent::Plugin
17
17
  def configure(conf)
18
18
  super
19
19
 
20
+ patterns = []
20
21
  @mask_config_list.each do |config|
21
22
  raise Fluent::ConfigError, "pattern is required" if config.pattern.nil?
23
+
24
+ patterns.push(config.pattern)
22
25
  end
26
+
27
+ log.info("plugin=maskrx at=configure patterns=\"#{patterns}\"")
23
28
  end
24
29
 
25
30
  def filter(_, _, record)
26
31
  log.debug("plugin=maskrx at=filter record=\"#{record}\"")
27
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)
28
49
  @mask_config_list.each do |config|
29
- record = mask_record(config, record)
50
+ record = mask_entry(config, record)
30
51
  end
31
52
 
32
53
  record
33
54
  end
34
55
 
35
- protected
36
- def mask_record(config, record)
37
- keys = (config.keys.nil? ? record.keys : config.keys)
38
- log.debug("plugin=maskrx at=mask_record keys=\"#{keys}\"")
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}\"")
39
64
 
40
65
  keys.each do |key|
41
66
  record[key] = mask_key_value(config.pattern, config.mask, record[key]) unless record[key].nil?
@@ -56,7 +81,7 @@ module Fluent::Plugin
56
81
  value.gsub!(m, mask)
57
82
  end
58
83
 
59
- log.debug("plugin=maskrx at=mask_key_value pattern=#{pattern} value=#{value}")
84
+ log.debug("plugin=maskrx at=mask_key_value pattern=#{pattern} value=\"#{value}\"")
60
85
 
61
86
  return value
62
87
  end
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.beta3
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-09-15 00:00:00.000000000 Z
11
+ date: 2021-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler