You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fluentd filter plugin to mask sensitive or privacy records with `*******` in place of the original value. This data masking plugin protects data such as name, email, phonenumber, address, and any other field you would like to mask.
7
7
8
-
##Requirements
8
+
# Requirements
9
9
| fluent-plugin-masking | fluentd | ruby |
10
10
| --------------------- | ---------- | ------ |
11
11
| 1.2.x | >= v0.14.0 | >= 2.5 |
12
12
13
13
14
-
##Installation
14
+
# Installation
15
15
Install with gem:
16
16
17
-
`gem install fluent-plugin-masking`
17
+
`fluent-gem install fluent-plugin-masking`
18
18
19
-
##Setup
19
+
# Setup
20
20
In order to setup this plugin, the parameter `fieldsToMaskFilePath` needs to be a valid path to a file containing a list of all the fields to mask. The file should have a unique field on each line. These fields **are** case-sensitive (`Name` != `name`).
21
21
22
-
In addition, there's an optional parameter called `fieldsToExcludeJSONPaths` which receives as input a comma separated string of JSON fields that should be excluded in the masking procedure. Nested JSON fields are supported by `dot notation` (i.e: `path.to.excluded.field.in.record.nestedExcludedField`)
23
-
The JSON fields that are excluded are comma separated.
24
-
This can be used for logs of registration services or audit log entries which do not need to be masked.
25
-
This is configured as shown below:
22
+
### Optional configuration
23
+
-`fieldsToExcludeJSONPaths` - this field receives as input a comma separated string of JSON fields that should be excluded in the masking procedure. Nested JSON fields are supported by `dot notation` (i.e: `path.to.excluded.field.in.record.nestedExcludedField`) The JSON fields that are excluded are comma separated.
24
+
This can be used for logs of registration services or audit log entries which do not need to be masked.
25
+
26
+
-`handleSpecialEscapedJsonCases` - a boolean value that try to fix special escaped json cases. this feature is currently on alpha stage (default: false). for more details about thoose special cases see [Special Json Cases](#Special-escaped-json-cases-handling)
27
+
28
+
An example with optional configuration parameters:
hashObjectRegex=Regexp.new(/(?::#{value}=>")(.*?)(?:")/mi)# mask element in hash object
96
+
innerJSONStringRegex=Regexp.new(/(\\+)"#{value}\\+":\\+.+?((?=(})|,( *|)(\s|\\+)\")|(?=}"$))/mi)# mask element in json string using capture groups that count the level of escaping inside the json string
hashObjectRegex=Regexp.new(/(?::#{value}=>")(.*?)(?:")/m)# mask element in hash object
100
+
innerJSONStringRegex=Regexp.new(/(\\+)"#{value}\\+":\\+.+?((?=(})|,( *|)(\s|\\+)\")|(?=}"$))/m)# mask element in json string using capture groups that count the level of escaping inside the json string
89
101
end
90
102
91
103
@fields_to_mask.push(value)
@@ -100,6 +112,10 @@ def configure(conf)
100
112
end
101
113
end
102
114
115
+
# if true, each record (a json record), will be checked for a special escaped json cases
116
+
# any found case will be 'gsub' with the right solution
0 commit comments