数据脱敏
简介
processor_desensitize插件可以通过正则表达式匹配并实现文本日志中敏感数据的脱敏。源代码
配置参数
参数
类型,默认值
说明
Type
String,无默认值(必填)
插件类型,固定为processor_desensitize
SourceKey
String,无默认值(必填)
日志字段名称。
Method
String,无默认值(必填)
脱敏方式。可选值如下: const:将敏感内容替换成 ReplaceString 参数处配置等字符串。 md5:将敏感内容替换为其对应的MD5值。
Match
String,无默认值(必填)
指定敏感数据。可选值如下: full:字段全文。 regex:使用正则提取敏感数据。
ReplaceString
String,无默认值
用于替换敏感内容等字符串,当 Method 设置为 const 时,必须配置。
RegexBegin
String,无默认值
用于指定敏感内容前缀的正则表达式,当 SelectFullField 配置为 false 时必填。
RegexContent
String,无默认值
用于指定敏感内容的正则表达式,当 SelectFullField 配置为 false 时必填。
样例
采集/home/test-ilogtail/test-log/路径下包含敏感数据的processor-desensitize.log文件,根据指定的配置选项提取日志信息。
输入
echo "[{'account':'1812213231432969','password':'04a23f38'}, {account':'1812213685634','password':'123a'}]" >> /home/test-ilogtail/test-log/processor-desensitize.log采集配置1
enable: true
inputs:
- Type: file_log
LogPath: /home/test-ilogtail/test-log/
FilePattern: processor-desensitize.log
processors:
- Type: processor_desensitize
SourceKey: content
Method: "const"
Match: "full"
ReplaceString: "********"
flushers:
- Type: flusher_stdout
OnlyStdout: true输出1
采集配置2
输出2
采集配置3
输出3
Last updated