If you use Logtail to collect logs, you can use the processor_add_fields plug-in to add log fields. This topic describes the parameters of the processor_add_fields plug-in and provides examples on how to configure the plug-in.
Important You can use form configuration to add Logtail plug-ins only if you select Kubernetes - Standard Output in the Import Data section.
Entry point
If you want to use a Logtail plug-in to process logs, you can add a Logtail plug-in configuration when you create or modify a Logtail configuration. For more information, see Entry point.
Important Only Logtail V0.16.28 or later supports the processor_add_fields plug-in.
Usage notes
Form configuration
- ParametersSet the Processor Type parameter to Add Field. The following table describes the parameters.
Parameter Description Add Field The name and value of the field that you want to add. You can add multiple fields. Ignore New Fields with Same Name Specifies whether to ignore duplicate fields if the fields have the same name. - Sample configurationThe following example shows how to add the aaa2 and aaa3 fields to a log.
- Raw log
"aaa1":"value1"
- Logtail plug-in configuration for data processing
- Result
"aaa1":"value1" "aaa2":"value2" "aaa3":"value3"
- Raw log
Editor configuration in JSON
- ParametersThe following table describes the parameters that you can configure in the detail parameter if you set the type parameter to processor_add_fields.
Parameter Type Required Description Fields Map Yes The name and value of the field that you want to add. You can specify multiple key-value pairs in the parameter. IgnoreIfExist Boolean No Specifies whether to ignore duplicate fields if the fields have the same name. Valid values: - true: ignores duplicate fields.
- false: does not ignore duplicate fields. This is the default value.
- Sample configurationThe following example shows how to add the aaa2 and aaa3 fields to a log.
- Raw log
"aaa1":"value1"
- Logtail plug-in configuration for data processing
{ "processors":[ { "type":"processor_add_fields", "detail": { "Fields": { "aaa2": "value2", "aaa3": "value3" } } } ] }
- Result
"aaa1":"value1" "aaa2":"value2" "aaa3":"value3"
- Raw log