脱敏原生处理插件
简介
processor_desensitize_native 插件对事件指定字段内容进行脱敏。
版本
版本说明
- 推荐版本:iLogtail v2.0.0 及以上
配置参数
| 参数 | 类型 | 是否必填 | 默认值 | 说明 |
|---|---|---|---|---|
| Type | string | 是 | / | 插件类型。固定为processor_desensitize_native。 |
| SourceKey | string | 是 | / | 源字段名。 |
| Method | string | 是 | / | 脱敏方式。可选值包括:
|
| ReplacingString | string | 否,当Method取值为const时必选 | / | 用于替换敏感内容的常量字符串。 |
| ContentPatternBeforeReplacedString | string | 是 | / | 敏感内容的前缀正则表达式。 |
| ReplacedContentPattern | string | 是 | / | 敏感内容的正则表达式。 |
| ReplacingAll | bool | 否 | true | 是否替换所有的匹配的敏感内容。 |
样例
采集文件/home/test-log/sen.log,将日志内容中的密码替换成******,并将结果输出到stdout。
- 输入
{"account":"1812213231432969","password":"04a23f38"}
- 采集配置
enable: true
inputs:
- Type: input_file
FilePaths:
- /home/test-log/sen.log
processors:
- Type: processor_desensitize_native
SourceKey: content
Method: const
ReplacingString: '******'
ContentPatternBeforeReplacedString: 'password":"'
ReplacedContentPattern: '[^"]+'
flushers:
- Type: flusher_stdout
OnlyStdout: true
- 输出
{
"__tag__:__path__": "/home/test-log/sen.log",
"content": "{\"account\":\"1812213231432969\",\"password\":\"******\"}",
"__time__": "1657161810"
}