Skip to content

Latest commit

 

History

History
59 lines (46 loc) · 1.24 KB

processor-drop.md

File metadata and controls

59 lines (46 loc) · 1.24 KB

丢弃字段

简介

processor_drop processor插件可以丢弃日志字段。

配置参数

参数 类型 是否必选 说明
Type String 插件类型。
DropKeys String[] 指定待丢弃的字段,支持配置多个。

样例

采集/home/test-log/路径下的json.log文件,并按照Json格式进行日志解析,然后对解析后的字段进行丢弃。

  • 输入
echo '{"key1": 123456, "key2": "abcd"}' >> /home/test-log/json.log
  • 采集配置
enable: true
inputs:
  - Type: file_log
    LogPath: /home/test-log/
    FilePattern: key_value.log
processors:
  - Type: processor_json
    SourceKey: content
    KeepSource: false
    ExpandDepth: 1
    ExpandConnector: ""
  - Type: processor_drop
    DropKeys: 
      - key1
flushers:
  - Type: flusher_sls
    Endpoint: cn-xxx.log.aliyuncs.com
    ProjectName: test_project
    LogstoreName: test_logstore
  - Type: flusher_stdout
    OnlyStdout: true
  • 输出
{
    "__tag__:__path__": "/home/test-dir/test_log/json.log",
    "key2": "abcd",
    "__time__": "1657354602"
}