Querying Structuring Templates
Function
This API is used to query details about custom structuring templates, which are essential for structuring configuration.
A user can call this API for up to 50 times per second.
Calling Method
For details, see Calling APIs.
URI
GET /v3/{project_id}/lts/struct/customtemplate
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Parameter description: Project ID. For details about how to obtain it, see Obtaining the Project ID, Account ID, Log Group ID, and Log Stream ID. Constraints: N/A. Value range: N/A. Default value: N/A. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
id |
No |
String |
Parameter description: ID of the template to be queried. This parameter is optional. If this parameter is left empty, all custom structuring templates in the project are returned. Constraints: N/A. Value range: N/A. Default value: N/A. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Parameter description: User token obtained from IAM. For details about how to obtain it, see Obtaining a User Token. Constraints: N/A. Value range: N/A. Default value: N/A. |
Content-Type |
Yes |
String |
Parameter description: Set this parameter to application/json;charset=UTF-8. Constraints: N/A. Value range: N/A. Default value: N/A. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
results |
Array of StructTemplateModel objects |
Parameter description: List of queried custom structuring templates. Value range: N/A. |
Parameter |
Type |
Description |
---|---|---|
project_id |
String |
Parameter description: Project ID. Value range: N/A. |
template_name |
String |
Parameter description: Template name. Value range: Enter up to 64 characters. Do not start with a period (.) or underscore (_) or end with a period. Only letters, digits, hyphens (-), underscores, and periods are allowed. |
template_type |
String |
Parameter description: Template type. The value can be regex, json, split, nginx, built_in, or custom_regex. Value range: N/A. |
demo_log |
String |
Parameter description: Sample log event. Value range: N/A. Minimum: 1 Maximum: 5000 |
demo_fields |
Array of DemoField objects |
Parameter description: Fields generated after the sample log event is parsed based on the structuring configuration. Value range: N/A. |
tag_fields |
Array of TagFieldNew objects |
Parameter description: Fixed fields generated based on the log reporting channel. Value range: N/A. |
rule |
TemplateRule object |
Parameter description: Structuring method. Value range: N/A. |
demo_label |
String |
Parameter description: Tags of the sample log event. Value range: N/A. |
create_time |
Long |
Parameter description: Creation time. Value range: N/A. |
id |
String |
Parameter description: Project ID. For details about how to obtain it, see Obtaining the Project ID, Account ID, Log Group ID, and Log Stream ID. Value range: N/A. |
Parameter |
Type |
Description |
---|---|---|
field_name |
String |
Parameter description: Field name. Value range: Enter up to 64 characters. Do not start with a period (.) or underscore (_) or end with a period. Only letters, digits, hyphens (-), underscores, and periods are allowed. |
content |
String |
Parameter description: Field example. Value range: N/A. |
type |
String |
Parameter description: Field data type. The value can be string, long, or float. Value range: string, float, or long |
is_analysis |
Boolean |
Parameter description: Whether quick analysis is enabled. If indexing is configured, the quick analysis setting specified on the Index Settings tab page is applied. Value range: N/A. |
index |
Integer |
Parameter description: Field sequence number in regular expression and delimiter methods. Value range: N/A. |
relation |
String |
Parameter description: Hierarchical relationship between fields in a multi-level JSON file. Value range: N/A. |
user_defined_name |
String |
Parameter description: Custom field alias in JSON and Nginx modes. Value range: Enter up to 64 characters. Do not start with a period (.) or underscore (_) or end with a period. Only letters, digits, hyphens (-), underscores, and periods are allowed. |
Parameter |
Type |
Description |
---|---|---|
field_name |
String |
Parameter description: Field name. Value range: Enter up to 64 characters. Do not start with a period (.) or underscore (_) or end with a period. Only letters, digits, hyphens (-), underscores, and periods are allowed. |
content |
String |
Parameter description: Field example. Value range: N/A. |
type |
String |
Parameter description: Field type. Value range: string, float, or long |
is_analysis |
Boolean |
Parameter description: Whether quick analysis is enabled. If indexing is configured, the quick analysis setting specified on the Index Settings tab page is applied. Value range: N/A. |
index |
Integer |
Parameter description: Field sequence number. Value range: N/A. |
Parameter |
Type |
Description |
---|---|---|
type |
String |
Parameter description: Structuring method. Value range: When param is set to built_in, this parameter indicates the name of the structuring template. |
param |
String |
Parameter description: Structuring parameters. Value range: regex, json, split, nginx, built_in, or custom_regex |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Parameter description: Error code. Value range: N/A. |
error_msg |
String |
Parameter description: Error message. Value range: N/A. |
Example Requests
Query the structuring template details.
GET https://{endpoint}/v3/{project_id}//v3/{project_id}/lts/struct/customtemplate /v3/{project_id}/lts/struct/customtemplate
Example Responses
Status code: 200
The request is successful.
{
"results" : [ {
"create_time" : 1641258099551,
"demo_fields" : [ {
"content" : "2022-01-03/14:52:28",
"field_name" : "field1",
"index" : 0,
"is_analysis" : true,
"type" : "string"
}, {
"content" : "this",
"field_name" : "field2",
"index" : 1,
"is_analysis" : true,
"type" : "string"
}, {
"content" : "log",
"field_name" : "field3",
"index" : 2,
"is_analysis" : false,
"type" : "string"
}, {
"content" : "is",
"field_name" : "field4",
"index" : 3,
"is_analysis" : false,
"type" : "string"
}, {
"content" : "Error",
"field_name" : "field5",
"index" : 4,
"is_analysis" : false,
"type" : "string"
}, {
"content" : "NO",
"field_name" : "field6",
"index" : 5,
"is_analysis" : false,
"type" : "string"
}, {
"content" : "13 testing.",
"field_name" : "field7",
"index" : 6,
"is_analysis" : false,
"type" : "string"
}, {
"content" : "286",
"field_name" : "field8",
"index" : 7,
"is_analysis" : false,
"type" : "long"
} ],
"demo_log" : "2022-01-03/14:52:28 this log is Error NO 13 testing 286.",
"id" : "43a8cc7b-b632-4c36-a65d-8150e98219f1",
"project_id" : "2a473356cca5487f8373be89xxxxxxxx",
"rule" : {
"param" : "{\"keyObject\":{\"0\":\"field1\",\"1\":\"field2\",\"2\":\"field3\",\"3\":\"field4\",\"4\":\"field5\",\"5\":\"field6\",\"6\":\"field7\",\"7\":\"field8\"},\"tokenizer\":\" \"}",
"type" : "split"
},
"demo_label" : "{}",
"tag_fields" : [ {
"content" : "172.16.10.69",
"field_name" : "hostIP",
"index" : 0,
"is_analysis" : true,
"type" : "string"
} ],
"template_name" : "testSplit13",
"template_type" : "split"
} ]
}
Status code: 500
The server has received the request but encountered an internal error.
{
"error_code" : "LTS.2017",
"error_msg" : "Find struct template failed."
}
Status Codes
Status Code |
Description |
---|---|
200 |
The request is successful. |
500 |
The server has received the request but encountered an internal error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot