addfields

package
v1.0.33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

README

字段添加

该插件可添加指定的字段(支持多个)。

参数说明

插件类型(type)为 processor_add_fields

参数 类型 必选或可选 参数说明
Fields map 必选 键值对,指定要添加的(多个)键值。
IgnoreIfExist bool 可选 存在相同的key是否忽略,默认为false。
示例

添加两个字段 aaa2aaa3,配置详情及处理结果如下:

  • 输入
"aaa1":"value1"
  • 配置详情
{
  "processors":[
    {
      "type":"processor_add_fields",
      "detail": {
        "Fields": {
          "aaa2": "value2",
          "aaa3": "value3"
        }
      }
    }
  ]
}
  • 配置后结果
"aaa1":"value1"
"aaa2":"value2"
"aaa3":"value3"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProcessorAddFields

type ProcessorAddFields struct {
	Fields        map[string]string // the appending fields
	IgnoreIfExist bool              // Whether to ignore when the same key exists
	// contains filtered or unexported fields
}

ProcessorAddFields struct implement the Processor interface. The plugin would append the field to the input data.

func (*ProcessorAddFields) Description

func (*ProcessorAddFields) Description() string

func (*ProcessorAddFields) Init

func (p *ProcessorAddFields) Init(context ilogtail.Context) error

Init method would be triggered before working for init some system resources, like socket, mutex. In this plugin, it verifies Fields must not be empty.

func (*ProcessorAddFields) ProcessLogs

func (p *ProcessorAddFields) ProcessLogs(logArray []*protocol.Log) []*protocol.Log

ProcessLogs append Fields to each log.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL