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

Torch Log Service

Copy page
Download PDF
LogCollector plugins
JSON parsing plugin
Copy page
Download PDF
JSON parsing plugin
You can use json plugin to expand the JSON structure and parse log fields. This topic describes the json plugin parameters and provides configuration examples.​
Notice​
  • In a complete log that contains JSON structured fields, keys must not be duplicated.​
  • This plugin is supported in LogCollector V1.0.12 and later versions. To view LogCollector version, see 2. View software version.​
Parameters description​
​
Name​
Type​
Required​
Dscription​
field​
String​
Yes​
Field name to be processed by the LogCollector plugin.​
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.​
trim_keys.mode​
string​
No​
The trim_keys specifies whether to remove characters from both ends of the key. The mode parameter defines the removal method.​
  • none: No string is removed.​
  • all (default): Remove strings from both ends of the key.​
  • left: Remove strings from the beginning of the key.​
  • right: Remove strings from the end of the key.​
trim_keys.chars​
string​
No​
The trim_keys is used to specify whether to remove strings from both ends of the key. The chars parameter defines the range of characters to remove. By default, it is double quotation mark (").​
trim_values.mode​
String​
No​
The trim_values specifies whether to remove strings from both ends of the value string, with the mode parameter defining the removal method.​
  • none: No string is removed.​
  • all: (default) Remove strings from both ends of the value.​
  • left: Remove strings from the beginning of the value.​
  • right: Remove strings from the end of the value string.​
trim_values.chars​
String​
No​
The trim_values specifies whether to remove strings from both ends of the value string; the chars parameter defines the range of characters to remove. By default, it is double quotation mark (").​
allow_empty_values​
boolean​
No​
If a specified field value contains a subfield with an empty value after parsing, this parameter determines whether to keep this key-value pair.​
  • true: Keep key-value pairs with empty values.​
  • false: (Default) Do not keep key-value pairs with empty values.​
allow_overwrite_keys​
boolean​
No​
If the key specified in keys duplicates an existing key in the collection configuration, this parameter determines whether to overwrite the field corresponding to the existing key.​
  • true: overwrite​
  • false: (Default) If a key is duplicated, the LogCollector plugin configuration fails to execute.​
​
Configuration examples​
  • raw logs​
  • ​
    "json_key": "{\"data\":\"Click Here\",\"size\":36,\"style\":\"bold\",\"name\":\"text1\",\"hOffset\":250,\"vOffset\":100,\"alignment\":\"#center#\",\"#onMouseUp#\":\"sun1.opacity = (sun1.opacity / 100) * 90;\"}"​
    ​
  • LogCollector plugin processing configuration​
  • ​
    {​
    "processors":[​
    {​
    "json":{​
    "field":"json_key",​
    "trim_keys":{​
    "mode":"all",​
    "chars":"#"​
    },​
    "trim_values":{​
    "mode":"all",​
    "chars":"#"​
    },​
    "allow_overwrite_keys":true,​
    "allow_empty_values":true​
    }​
    }​
    ]​
    }​
    ​
  • Processing result​
  • ​
    "data": "Click Here"​
    "size": "36"​
    "style": "bold"​
    "name": "text1"​
    "hOffset": "250"​
    "vOffset": "100"​
    "alignment": "center"​
    "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;"​
    ​
​
Last updated: 2025.12.12 10:30:52