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

Torch Log Service

Copy page
Download PDF
LogCollector plugins
Field splitting and reassembly plugin
Copy page
Download PDF
Field splitting and reassembly plugin
You can use LogCollector's split_select plugin to split the value of a specified field by your chosen separator, select elements by index, and combine them into a new field to add to your log.​
  • Separator: used to split the original field and assemble selected elements.​
  • Index: used to select elements after splitting a field. The starting index starts from 0 and is a closed interval.​
Notice​
This plugin is supported in LogCollector V2.2.5 and later versions. To view LogCollector version, see 2. View software version.​
split_select plugin parameter description​
​
Name​
Type​
Required​
Description​
field​
String​
Yes​
Name of the field that contains values to split.​
new_field​
String​
Yes​
Name of the new field to store joined values.​
separator​
String​
Yes​
Separator for splitting the value of the field.​
index​
Object​
Yes​
Select the index range of the elements after splitting.​
keep_source​
Boolean​
No​
This parameter determines whether to retain the original field value.​
​
Index parameter instructions:​
​
Name​
Type​
Required​
Description​
start_index​
Integer​
Yes​
Starting position of the index.​
end_index​
Integer​
Yes​
Ending position of the index.​
-1 means to select up to the last element.​
​
Example of selecting elements in the middle of a field​
  • Log content:​
  • ​
    {​
    "path_info": "/usr/local/bin/app"​
    }​
    ​
  • Processor configuration of LogCollector split_select plugin​
  • Keep the original field path_info value; split by the separator /; select the elements at index positions [1,2]; and save them to the selected_path field.​
  • ​
    {​
    "processors": [​
    {​
    "split_select": {​
    "field": "path_info",​
    "new_field": "selected_path",​
    "separator": "/",​
    "index": {​
    "start_index": 1,​
    "end_index": 2​
    },​
    "keep_source": true​
    }​
    }​
    ]​
    }​
    ​
  • Processing result:​
Notice​
The index position starts before the specified separator "/".​
  • ​
    {​
    "path_info": "/usr/local/bin/app",​
    "selected_path": "usr/local"​
    }​
    ​
Example of selecting field elements from the specified position to the end​
  • The key-value log is as follows:​
  • ​
    {​
    "tags": "apple,banana,orange,grape"​
    }​
    ​
  • The split_select plugin processor configuration for LogCollector is as follows:​
  • Keep no original field tags value; split by the separator ,; select elements from index 2 to the end after splitting; and save them to the last_two_fruits field.​
  • ​
    {​
    "processors": [​
    {​
    "split_select": {​
    "field": "tags",​
    "new_field": "last_two_fruits",​
    "separator": ",",​
    "index": {​
    "start_index": 2,​
    "end_index": -1​
    },​
    "keep_source": false​
    }​
    }​
    ]​
    }​
    ​
  • Processing result:​
  • ​
    {​
    "last_two_fruits": "orange,grape"​
    }​
    ​
Example of selecting the first element of a field​
  • The key-value log is as follows:​
  • ​
    {​
    "file_name": "report.final.docx",​
    }​
    ​
  • The split_select plugin processor configuration for LogCollector is as follows:​
  • Keep the original file_name field value; split it by the separator; select the first element after splitting; and save it to the base_name field.​
  • ​
    {​
    "processors": [​
    {​
    "split_select": {​
    "field": "file_name",​
    "new_field": "base_name",​
    "separator": ".",​
    "index": {​
    "start_index": 0,​
    "end_index": 0​
    },​
    "keep_source": true​
    }​
    }​
    ]​
    }​
    ​
  • Processing result:​
  • ​
    {​
    "file_name": "report.final.docx",​
    "base_name": "report"​
    }​
    ​
​
Last updated: 2025.12.12 14:07:35