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.  | 
tagFields  | Array of tag_fields_info objects  | Keyword details.  | 
demoLog  | String  | Sample log event.  | 
demoLabel  | String  | Attributes of the sample log event.  | 
id  | String  | Structuring rule ID.  | 
logGroupId  | String  | Log group ID.  | 
rule  | ShowStructTemplateRule object  | Structuring method.  | 
cluster_info  | Kafka information.  | |
logStreamId  | String  | Log stream ID.  | 
projectId  | String  | Project ID.  | 
templateName  | String  | Template name.  | 
regex  | String  | Regular expression.  | 
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.  | 
Parameter  | Type  | Description  | 
|---|---|---|
fieldName  | String  | Field name.  | 
type  | String  | Field type.  | 
content  | String  | Content.  | 
isAnalysis  | Boolean  | Whether parsing is enabled.  | 
index  | Integer  | Field sequence number.  | 
Parameter  | Type  | Description  | 
|---|---|---|
param  | String  | Structuring parameter.  | 
type  | String  | Structuring type.  | 
Parameter  | Type  | Description  | 
|---|---|---|
cluster_name  | String  | Kafka cluster name.  | 
kafka_bootstrap_servers  | String  | Kafka cluster server address.  | 
kafka_ssl_enable  | Boolean  | Whether SSL encrypted authentication is enabled for Kafka.  | 
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.
{
  "demoFields" : [ {
    "content" : "100.19.10.178",
    "fieldName" : "authority",
    "index" : 0,
    "isAnalysis" : true,
    "type" : "string"
  }, {
    "content" : "0",
    "fieldName" : "bytes_received",
    "index" : 0,
    "isAnalysis" : true,
    "type" : "string"
  }, {
    "content" : "1127",
    "fieldName" : "bytes_sent",
    "index" : 0,
    "isAnalysis" : true,
    "type" : "string"
  } ]
}
Status code: 400
BadRequest. The request is invalid. Modify the request based on the description in error_msg before a retry.
{
  "errorCode" : "SVCSTG.ALS.200201",
  "errorMessage" : "Query Param is error."
}
Status code: 401
AuthFailed. Authentication failed. Check the token and try again.
{
  "error_code" : "LTS.0414",
  "error_msg" : "Invalid token"
}
Status code: 403
Forbidden.The request has been rejected.The server has received the request and understood it, but refuses to respond to it. The client should not repeat the request without modifications.
{
  "error_code" : "LTS.0001",
  "error_msg" : "Invalid projectId"
}
Status code: 500
InternalServerError.
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  | BadRequest. The request is invalid. Modify the request based on the description in error_msg before a retry.  | 
401  | AuthFailed. Authentication failed. Check the token and try again.  | 
403  | Forbidden.The request has been rejected.The server has received the request and understood it, but refuses to respond to it. The client should not repeat the request without modifications.  | 
500  | InternalServerError. The server has received the request but encountered an internal error.  | 
503  | ServiceUnavailable. The requested service is unavailable.  | 
Error Codes¶
See Error Codes.