Querying Log Streams
Function
This API is used to query log stream details. It helps you learn about the running and management status of the log streams and provides comprehensive and accurate data support.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
lts:logStream:listLogStream
List
logGroup *
g:ResourceTag/<tag-key>
- lts:topics:get
- lts:topics:list
-
URI
GET /v2/{project_id}/log-streams
|
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 |
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 |
|---|---|---|
|
log_streams |
Array of LogStreamNoIsFavorite objects |
Definition Log stream configuration information. |
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: 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
If you leave the request body empty, all log streams are queried. If log_group_name and log_stream_name are specified, the corresponding log stream is queried.
GET https://{endpoint}/v2/{project_id}/log-streams
/v2/{project_id}/log-streams /v2/{project_id}/log-streams?log_group_name={log_group_name}
/v2/{project_id}/log-streams?log_stream_name={log_stream_name}
/v2/{project_id}/log-streams?log_stream_name={log_stream_name} &log_group_name={log_group_name}
Example Responses
Status code: 200
Log stream information is returned.
{
"log_streams" : [ {
"log_stream_name_alias" : "lts-topic-xxxx",
"creation_time" : 1698915657847,
"auth_web_tracking" : false,
"log_stream_name" : "lts-topic-xxxx",
"is_favorite" : false,
"hot_storage_days" : -1,
"tag" : {
"_sys_enterprise_project_id" : "xxxxxx"
},
"hot_cold_separation" : false,
"filter_count" : 0,
"log_stream_id" : "xxxxxxx",
"ttl_in_days" : 7,
"whether_log_storage" : true
}, {
"log_stream_name_alias" : "lts-topic-xxxx",
"creation_time" : 1698915650021,
"auth_web_tracking" : false,
"log_stream_name" : "lts-topic-xxxx",
"is_favorite" : false,
"hot_storage_days" : -1,
"tag" : {
"_sys_enterprise_project_id" : "xxxxxxx"
},
"hot_cold_separation" : false,
"filter_count" : 0,
"log_stream_id" : "xxxxxxxxxxxxxxxxxxx",
"ttl_in_days" : 7,
"whether_log_storage" : true
} ]
}
Status code: 400
Invalid request. Modify the request based on the description in error_msg before a retry.
{
"error_code" : "LTS.0205",
"error_msg" : "The log stream name has been existed"
}
Status code: 500
The server has received the request but encountered an internal error.
{
"error_code" : "LTS.0010",
"error_msg" : "The system encountered an internal error"
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Log stream information is returned. |
|
400 |
Invalid request. Modify the request based on the description in error_msg before a retry. |
|
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