Sanitizeris Fluentd filter plugin to mask sensitive information. With Sanitizer, you can mask based on key-value pairs on the fly in between Fluentd processes. Sanitizer provides options which enable you to mask values with custom rules. In custom rules, you can specify patterns such as IP addresses, hostnames in FQDN style, regular expressions and keywords. In terms of IP addresses and hostnames, Sanitizer delivers useful options which allows you to easily mask IP addresses and hostnames in complex messages.
Installation
When you are using OSS Fluentd :
fluent-gem install fluent-plugin-sanitizer
When you are using td-agent :
td-agent-gem install fluent-plugin-sanitizer
Configuration
Parameters
hash_salt (optional) : hash salt used when calculating hash value with original information.
hash_scheme (optional) : Hash scheme to use for generating hash value. Supported schemes are md5,sha1,sha256,sha384 and sha512. (default: md5)
rule options :
keys (mandatory) : Name of keys whose values will be masked. You can specify multiple keys. When keys are nested, you can use {parent key}.{child key} like “kubernetes.master_url”.
pattern_ipv4 (optional) : Mask IP addresses in IPv4 format. You can use “true” or “false”. (defalt: false)
pattern_fqdn (optional) : Mask hostname in FQDN style. You can use “true” or “false”. (defalt: false)
pattern_regex (optional) : Mask value mactches custom regular expression.
regex_capture_group (optional) : If you define capture group in regular expression, you can specify the name of capture group to be masked.
pattern_regex_prefix (optional) : Define prefix used for masking vales. (default: Regex)
pattern_keywords (optional) : Mask values match custom keywords. You can specify multiple keywords.
pattern_keywords_prefix (optional) : Define prefix used for masking vales. (default: Keyword)
You can specify multiple rules in a single configuration. It is also possible to define multiple pattern options in a single rule like the following sample.
Masking IP addresses and hostnames is one of the typical use cases of security operations. You just need to specify the name of keys that potentially have IP addresses and hostnames in value. Here is a configuration sample as well as input and output samples.
Mask words match custom keyword and regular expression
In case log messages including sensitive information such as SSN and phone number, Sanitizer could also help you. If you know the exact keyword that needs to be masked, you can use the keyword option. You can also use the regex option if you like to mask information which matches custom a regular expression.
When you design custom rules in a configuration file, you might need information about how Sanitizer masks original values into hash values for debugging purposes. You can check that information if you run td-agent/Fluentd with debug option enabled. The debug information is shown in the log file of td-agent/Fluentd like the following log message sample.
Log message sample
YYYY-MM-DD Time fluent.debug: {"message":"[pattern_regex] sanitize '123-45-6789' to 'SSN_f6b6430343a9a749e12db8a112ca74e9'"}
YYYY-MM-DD Time fluent.debug: {"message":"[pattern_regex] sanitize '123-456-7890' to 'Phone_0a25187902a0cf755627397eb085d736'"}
Contribute
Contribution to fluent-plugin-sanitizer is always welcomed.
fluent-plugin-sanitizer
Sanitizeris Fluentd filter plugin to mask sensitive information. With Sanitizer, you can mask based on key-value pairs on the fly in between Fluentd processes. Sanitizer provides options which enable you to mask values with custom rules. In custom rules, you can specify patterns such as IP addresses, hostnames in FQDN style, regular expressions and keywords. In terms of IP addresses and hostnames, Sanitizer delivers useful options which allows you to easily mask IP addresses and hostnames in complex messages.
Installation
When you are using OSS Fluentd :
When you are using td-agent :
Configuration
Parameters
md5,sha1,sha256,sha384andsha512. (default:md5)You can specify multiple rules in a single configuration. It is also possible to define multiple pattern options in a single rule like the following sample.
Use cases
Mask IP addresses and Hostnames
Masking IP addresses and hostnames is one of the typical use cases of security operations. You just need to specify the name of keys that potentially have IP addresses and hostnames in value. Here is a configuration sample as well as input and output samples.
Configuration sample
Input sample
Output sample
Mask words match custom keyword and regular expression
In case log messages including sensitive information such as SSN and phone number, Sanitizer could also help you. If you know the exact keyword that needs to be masked, you can use the keyword option. You can also use the regex option if you like to mask information which matches custom a regular expression.
Configuration sample
Input sample
Output sample
From v0.1.2, “regex_capture_group” option is available. With “regex_capture_group” option, it is possible to mask specific part of original messages.
Configuration sample
Input sample
Output sample
Tips : Debug how sanitizer works
When you design custom rules in a configuration file, you might need information about how Sanitizer masks original values into hash values for debugging purposes. You can check that information if you run td-agent/Fluentd with debug option enabled. The debug information is shown in the log file of td-agent/Fluentd like the following log message sample.
Log message sample
Contribute
Contribution to fluent-plugin-sanitizer is always welcomed.
Copyright