Querying a Structuring Rule
Function
This API is used to query the structuring rule of a specified log stream.
Calling Method
For details, see Calling APIs.
URI
GET /v2/{project_id}/lts/struct/template
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Definition Project ID. It can be obtained by calling an API or from the console. For details, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
logGroupId |
Yes |
String |
Definition Log group ID. For details about how to obtain it, see Obtaining Log Group and Log Stream IDs. Constraints N/A Range N/A Default Value N/A |
logStreamId |
Yes |
String |
Definition Log stream ID. For details about how to obtain it, see Obtaining Log Group and Log Stream IDs. Constraints N/A Range N/A Default Value N/A |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Definition User token obtained from IAM. For details about how to obtain it, see Obtaining a User Token. Constraints: N/A Range N/A Default Value N/A |
Content-Type |
Yes |
String |
Definition Message body format. Set this parameter to application/json;charset=utf8. Constraints N/A Range N/A Default Value N/A |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
demoFields |
Array of StructFieldInfoReturn objects |
Definition Fields generated after the sample log event is parsed based on the structuring configuration. |
tagFields |
Array of tag_fields_info objects |
Definition Fixed fields generated based on the log reporting channel or static fields manually configured by the user. |
demoLog |
String |
Definition Sample log event. Range N/A |
demoLabel |
String |
Definition Complete JSON structure example of the sample log and system fields. Range N/A |
id |
String |
Definition Structuring configuration ID. Range N/A |
logGroupId |
String |
Definition Log group ID. Range N/A |
rule |
TemplateRule object |
Definition Structuring method. |
cluster_info |
Definition Kafka cluster information. |
|
logStreamId |
String |
Definition Log stream ID. Range N/A |
projectId |
String |
Definition Project ID. Range N/A |
templateName |
String |
Definition Structuring template name. Range N/A |
regex |
String |
Definition Regular expression. Range N/A |
custom_time_info |
customTimeInfo object |
Definition Parameters related to the custom time in the structuring configuration. Range N/A |
uploadOriginalLog |
Boolean |
Definition Whether to upload raw logs. Range
|
uploadParseFailedLog |
Boolean |
Definition Whether to upload the raw logs that fail to be parsed to the specified system fields. Range
|
Parameter |
Type |
Description |
---|---|---|
fieldName |
String |
Definition Name of an extracted field. Range N/A |
type |
String |
Definition Field data type. Range
|
content |
String |
Definition Sample content of the extracted field. Range N/A |
isAnalysis |
Boolean |
Definition Whether quick analysis is enabled. If indexing is configured, the quick analysis setting specified on the Index Settings tab page is applied. Range
|
index |
Integer |
Definition Field sequence number in regular expression and delimiter methods. Range N/A |
Parameter |
Type |
Description |
---|---|---|
fieldName |
String |
Definition Tag field name. Range N/A |
type |
String |
Definition Tag field type. Range
|
content |
String |
Definition Sample content of the tag field. Range N/A |
isAnalysis |
Boolean |
Definition Whether quick analysis is enabled. If indexing is configured, the quick analysis setting specified on the Index Settings tab page is applied. Range
|
index |
Integer |
Definition Field sequence number. Range N/A |
Parameter |
Type |
Description |
---|---|---|
type |
String |
Definition Structuring method of the structuring template. Range
|
param |
String |
Definition Structuring parameter. It contains configuration parameters required for the corresponding structuring type. For example, if type is set to split, the param field returns a JSON string containing delimiters. If type is set to regex, the param field returns the configured regular expression. Range N/A |
Parameter |
Type |
Description |
---|---|---|
cluster_name |
String |
Definition Kafka cluster name. Range N/A |
kafka_bootstrap_servers |
String |
Definition The Kafka cluster's server address. Range N/A |
kafka_ssl_enable |
Boolean |
Definition Whether SSL encrypted authentication is enabled for Kafka. Range
|
Parameter |
Type |
Description |
---|---|---|
enable |
Boolean |
Definition Whether to enable the custom time field. Range
|
key |
String |
Definition Field name selected from demoField as the log system time. Range N/A |
value |
String |
Definition Sample field content selected from demoField as the log system time. Range N/A |
time_format |
String |
Definition Time format parameter for parsing a field as the time type. Range N/A |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Definition Error code. For details, see Error Codes. Range N/A |
error_msg |
String |
Definition Error message. Range N/A |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Definition Error code. For details, see Error Codes. Range N/A |
error_msg |
String |
Definition Error message. Range N/A |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Definition Error code. For details, see Error Codes. Range N/A |
error_msg |
String |
Definition Error message. Range N/A |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Definition Error code. For details, see Error Codes. Range N/A |
error_msg |
String |
Definition Error message. Range N/A |
Example Requests
GET https://{endpoint}/v2/{project_id}/lts/struct/template /v2/{project_id}/lts/struct/template?logGroupId={logGroupId} &logStreamId={logStreamId}
Example Responses
Status code: 200
The request is successful and details of the structuring rule are returned.
{ "custom_time_info" : { "enable" : false, "key" : "", "value" : "" }, "demoFields" : [ { "content" : "aaa", "fieldName" : "field1", "index" : 0, "isAnalysis" : true, "type" : "string" }, { "content" : "bbb", "fieldName" : "field2", "index" : 1, "isAnalysis" : true, "type" : "string" }, { "content" : "ccc", "fieldName" : "field3", "index" : 2, "isAnalysis" : true, "type" : "string" }, { "content" : "ddd", "fieldName" : "field4", "index" : 3, "isAnalysis" : true, "type" : "string" } ], "demoLabel" : "{}", "demoLog" : "aaa bbb ccc ddd", "id" : "a0a1xxxxxx4491185d7cf26c3e86ada_86b5xxxx-11df-4361-b48e-b3861c3c761c_xxxx02c7-1dac-47d0-b3ef-39e2ed4e70da", "logGroupId" : "86b5xxxx-11df-4361-b48e-b3861c3c761c", "logStreamId" : "d9c4xxxx-1dac-47d0-b3ef-39e2ed4e70da", "projectId" : "a0a1xxxxxx4491185d7cf26c3e86ada", "rule" : { "param" : "{ \" keyObject \" :{ \" 0 \" : \" field1 \" , \" 1 \" : \" field2 \" , \" 2 \" : \" field3 \" , \" 3 \" : \" field4 \" }, \" tokenizer \" : \" \" , \" split_type \" : \" char \" }", "type" : "split" }, "tagFields" : [ ], "uploadOriginalLog" : true, "uploadParseFailedLog" : false }
Status code: 400
Invalid request. 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
Authentication failed. Check the token and try again.
{ "error_code" : "LTS.0414", "error_msg" : "Invalid token" }
Status code: 403
Request 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
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 |
The request is successful and 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 |
Request 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 |
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