Querying a Structuring Rule
Function
This API is used to query the structuring rule of a specified log stream.
URI
GET /v2/{project_id}/lts/struct/template
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Project ID. For details about how to obtain a project ID, see Obtaining the Project ID, Account ID, Log Group ID, and Log Stream ID. Minimum: 32 Maximum: 32 |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| logGroupId | Yes | String | Log group ID. For details about how to obtain a log group ID, see Obtaining the Project ID, Account ID, Log Group ID, and Log Stream ID. Minimum: 36 Maximum: 36 |
| logStreamId | Yes | String | Log stream ID. For details about how to obtain a log stream ID, see Obtaining the Project ID, Account ID, Log Group ID, and Log Stream ID. Minimum: 36 Maximum: 36 |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | User token obtained from IAM. For details about how to obtain a user token, see Obtaining a User Token. Minimum: 1000 Maximum: 2000 |
| Content-Type | Yes | String | Set this parameter to application/json;charset=UTF-8. Minimum: 30 Maximum: 30 |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| demoFields | Array of StructFieldInfoReturn objects | Structured field information parsed from logs. |
| tagFields | Array of tagFieldsInfo objects | Fixed fields generated based on the log reporting channel or static fields manually configured by the user. |
| demoLog | String | Sample log event. |
| demoLabel | String | This field has been discarded. If a structuring template is used, {} will be returned. |
| id | String | Structuring rule ID. |
| logGroupId | String | Log group ID. |
| rule | ShowStructTemplateRule object | Structuring method. |
| logStreamId | String | Log stream ID. |
| projectId | String | Project ID. |
| templateName | String | Template name. |
| regex | String | This field has been discarded. |
| custom_time_info | custom_time_info object | Custom time field information. |
| sql_analysis_enable | Boolean | Whether to enable the log analysis function. This field has been overwritten by a field with the same name in the index settings. |
| uploadOriginalLog | String | Whether to report raw logs. |
| uploadParseFailedLog | String | Whether to report logs that fail to be parsed. |
| Parameter | Type | Description |
|---|---|---|
| fieldName | String | Field name. |
| type | String | Field data type. |
| content | String | Field content. |
| isAnalysis | Boolean | Whether parsing is enabled. |
| index | Integer | Field sequence number. |
| isLabelField | Boolean | This field is discarded and is no longer used. |
| isModified | Boolean | This field is discarded and is no longer used. |
| Parameter | Type | Description |
|---|---|---|
| fieldName | String | Field name. |
| type | String | Field type. |
| content | String | Content. |
| isAnalysis | Boolean | Whether parsing is enabled. |
| index | Integer | Field No. |
| isModified | String | This field is discarded and is no longer used. |
| Parameter | Type | Description |
|---|---|---|
| param | String | Structuring parameter. |
| type | String | Structuring method. regex is the regular expression structuring parameter of the old version, which is discarded. Its functionality has been replaced by parameters custom_regex and regex_auto. Range
|
| Parameter | Type | Description |
|---|---|---|
| enable | Boolean | Whether to enable the custom reporting time function. |
| key | String | Structured field that is parsed as the reporting time. |
| time_format | String | Format that is used to parse a structured field into a time type. |
| value | String | Example of a structured field that is parsed as a time type. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_msg | String | Error message. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_msg | String | Error message. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_msg | String | Error message. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_msg | String | Error message. |
Example Requests
GET https://{endpoint}/v2/{project_id}/lts/struct/template?logGroupId=123456&logStreamId=654321 Example Responses
Status code: 200
Details of the structuring rule are returned.
{
"custom_time_info" : {
"enable" : false,
"key" : "",
"value" : ""
},
"demoFields" : [ {
"content" : "127.0.0.1:8080",
"end" : "26",
"fieldName" : "ip",
"index" : 0,
"isAnalysis" : true,
"isLabelField" : false,
"isModified" : false,
"start" : "20",
"type" : "string"
} ],
"demoLabel" : "{}",
"demoLog" : "https://127.0.0.1:8080",
"id" : "a0a12b069ab4491185d7cf26c3e86ada_86b572f8-11df-4361-b48e-b3861c3c761c_b7ce2abf-1625-42eb-89ea-cb396de4bb15",
"logGroupId" : "86b572f8-11df-4361-b48e-b3861c3c761c",
"logStreamId" : "b7ce2abf-1625-42eb-89ea-cb396de4bb15",
"projectId" : "a0a12b069abxxxx185d7cf26c3e86ada",
"rule" : {
"param" : "{\"keyObject\":{\"1\":\"ip\"},\"regex_rules\":\"^(?:[^\\\\.]*\\\\.){1}(\\\\w+)\"}",
"type" : "regex_auto"
},
"sql_analysis_enable" : true,
"tagFields" : [ {
"content" : "",
"fieldName" : "tag1",
"index" : 0,
"isAnalysis" : true,
"isModified" : false,
"type" : "string"
} ],
"uploadOriginalLog" : true,
"uploadParseFailedLog" : false
} Status code: 400
Invalid request. Modify the request based on the description in error_msg before a retry.
{
"error_code" : "SVCSTG.ALS.200201",
"error_msg" : "Query Param is error."
} Status code: 401
Authentication failed. Check the token and try again.
{
"error_code" : "LTS.0414",
"error_msg" : "Invalid token"
} Status code: 403
The request has been rejected. The server has received and understood the request but it refused to respond, because the request is set to deny access. Do not retry the request before modifying it.
{
"error_code" : "LTS.0001",
"error_msg" : "Invalid projectId"
} Status code: 500
The server has received the request but encountered an internal error.
{
"error_code" : "LTS.0102",
"error_msg" : "Query empty."
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Details of the structuring rule are returned. |
| 400 | Invalid request. Modify the request based on the description in error_msg before a retry. |
| 401 | Authentication failed. Check the token and try again. |
| 403 | The request has been rejected. The server has received and understood the request but it refused to respond, because the request is set to deny access. Do not retry the request before modifying it. |
| 500 | The server has received the request but encountered an internal error. |
| 503 | The requested service is unavailable. |
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