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.
Limits
Text logs and container standard output support only form-based configuration. Other input plugins support only JSON configuration.
Entry point
To use a Logtail plugin to process logs, you can add a plugin configuration when you create or modify a Logtail collection configuration. For more information, see Overview of Logtail plugins for data processing.
Configuration description
Only Logtail V0.16.28 and later support the processor_add_fields plug-in.
Form configuration
Parameters
Set the Processor Type parameter to Add Field. Then, configure other parameters based on the following table.
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.
Examples
The following example demonstrates how to add the
aaa2and aaa3 fields:Raw log
"aaa1":"value1"Logtail plug-in configuration for data processing

Processing result
"aaa1":"value1" "aaa2":"value2" "aaa3":"value3"
Editor configuration in JSON
Parameters
Set
typetoprocessor_add_fields. The following table describes the parameters in thedetailsection.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 to add multiple fields.
IgnoreIfExist
Boolean
No
Specifies whether to ignore duplicate fields if the fields have the same name. Valid values:
true: No action is taken.
false (default)
Examples
The 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" } } } ] }Processing result
"aaa1":"value1" "aaa2":"value2" "aaa3":"value3"
References
Configure a Logtail pipeline using API operations:
GetLogtailPipelineConfig - Get a Logtail pipeline configuration
ListLogtailPipelineConfig - List Logtail pipeline configurations
CreateLogtailPipelineConfig - Create a Logtail pipeline configuration
DeleteLogtailPipelineConfig - Delete a Logtail pipeline configuration
UpdateLogtailPipelineConfig - Update a Logtail pipeline configuration
Configure a processor plugin in the console:
Collect container logs from a Kubernetes cluster using a CRD (stdout/file)