You need to enable JavaScript to run this app.
Torch Log Service

Torch Log Service

Copy page
Download PDF
LogCollector plugins
Add field plugin
Copy page
Download PDF
Add field plugin
You can use the add_kvs plugin to specify fields for LogCollector to add in the logs.​
Notice​
  • The add_kvs plugin is supported by LogCollector V1.0.18 and later versions. To view LogCollector version, see 2. View software version.​
  • The add_kvs plugin processor supports adding environment variable fields from the host or container running LogCollector to logs. When adding environment variable fields, you can customize the field name (key). Set the field value to ${ENV_NAME}. TLS will automatically read the environment variable name and fill in the value. If the host or container running LogCollector does not have the environment variable ENV_NAME, the value is empty.​
Parameters description​
​
Name​
Type​
Required​
Description​
fields​
Map<String,Object>​
Yes​
Field names (key) and values (value) to be added.​
  • Key-value pair format; supports adding multiple fields.​
  • Field names must not be duplicate, empty, or contain periods (.).​
when​
Object​
No​
The plugin execution condition. This plugin is executed only when the condition is evaluated as true. For more details, see Plugin execution conditions.​
​
Configuration examples​
  • Raw logs​
  • ​
    [1] [Dec 15, 2012 1:42:43 AM] com.dev.log.LoggingExample main​
    ​
  • LogCollector plugin processor configuration​
  • ​
    {​
    "processors": [​
    {​
    "add_kvs": {​
    "fields": {​
    "name": "Jack",​
    "path": "${PATH}",​
    "cluster_id": "C02G64T1MD6R"​
    }​
    }​
    }​
    ]​
    }​
    ​
  • Processing result​
  • ​
    "__content__": "[1] [Dec 15, 2012 1:42:43 AM] com.dev.log.LoggingExample main"​
    "name": "Jack"​
    "path": "/Users/Jack/go/bin"​
    "cluster_id": "C02G64T1MD6R"​
    ​
​
Last updated: 2025.12.05 15:26:14