The processor_appender plugin appends a specific value to an existing or new field and supports template variables in the field value. This plugin is commonly used with time series monitoring plugins such as input_prometheus and input_system_v2 to enrich data pulled from Prometheus.
Logtail 0.16.66 and later supports the processor_appender plugin.
Parameters
Set type to processor_appender. The following table describes the parameters in the detail field.
Table 1. Plugin parameters
|
Parameter |
Type |
Required |
Description |
|
Key |
string |
Yes |
The field name. |
|
Value |
string |
Yes |
The value to append. Template variables are supported. For more information, see Template variables. |
|
SortLabels |
boolean |
No |
Specifies whether to sort labels alphabetically when Key is set to __labels__. Set this parameter to true to prevent query errors caused by unsorted labels. Default value: false. |
Table 2. Template variables
|
Template variable |
Description |
Configuration example |
Result example |
|
{{__ip__}} |
The IP address of the server where Logtail is installed. |
"Value": "{{__ip__}}" |
"Value": "192.0.2.1" |
|
{{__host__}} |
The hostname of the server where Logtail is installed. |
"Value": "{{__host__}}" |
"Value": "logtail-ds-xdfaf" |
|
{{$xxxx}} |
The value of the specified environment variable. The variable name must start with a dollar sign ($). |
"Value": "{{$WORKING_GROUP}}" |
"Value": "prod" |
Example
Assume a Logtail server has the IP address 192.0.2.1, the hostname david, and the environment variable WORKING_GROUP set to prod. The following configuration appends this data to the __labels__ field:
-
Raw data
"__labels__":"a#$#b" -
Logtail plugin configuration
{ "processors":[ { "type":"processor_appender", "detail": { "Key": "__labels__", "Value": "|host#$#{{__host__}}|ip#$#{{__ip__}}|group#$#{{$WORKING_GROUP}}", "SortLabels": true } } ] } -
Result
"__labels__":"a#$#b|group#$#prod|host#$#david|ip#$#192.0.2.1"