You can use the processor_rename plugin to rename fields when you collect logs with Logtail. This topic describes the parameters and provides configuration examples for the processor_rename plugin.
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
The processor_rename plugin is supported in Logtail 0.16.28 and later.
Form-based configuration
Parameters
Set Processor Type to Rename Fields. The following table describes the parameters.
Parameter
Description
Source Field
The source field to rename.
Result Field
The name of the field after it is renamed.
Report Error For Missing Source Field
Select this option to report an error if the specified source field does not exist in the log.
Example
The following example shows how to rename the
aaa1field to bbb1 and the aaa2 field to bbb2.Raw log
"aaa1":"value1" "aaa2":"value2" "aaa3":"value3"Logtail plugin configuration

Result
"bbb1":"value1" "bbb2":"value2" "aaa3":"value3"
JSON configuration
Parameters
Set
typetoprocessor_rename. The following table describes the parameters indetail.Parameter
Type
Required
Description
NoKeyErrorBoolean
No
Specifies whether to report an error if the specified source field does not exist in the log.
true: An error is reported.
false (default): No error is reported.
SourceKeysString array
Yes
The source fields to rename.
DestKeysString array
Yes
The result fields.
Example
The following example shows how to rename the
aaa1field tobbb1and theaaa2field tobbb2.Raw log
"aaa1":"value1" "aaa2":"value2" "aaa3":"value3"Logtail plugin configuration
{ "processors":[ { "type":"processor_rename", "detail": { "SourceKeys": ["aaa1","aaa2"], "DestKeys": ["bbb1","bbb2"], "NoKeyError": true } } ] }Result
"bbb1":"value1" "bbb2":"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)