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.
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 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
log_group_name |
No |
String |
Definition Log group name. Constraints N/A Range
Default Value N/A |
log_stream_name |
No |
String |
Definition Log stream name. Constraints N/A Range
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. |
Parameter |
Type |
Description |
---|---|---|
creation_time |
Long |
Definition Time when the log stream was created. The value must be a UNIX timestamp, measured in milliseconds from January 1, 1970, 00:00:00 UTC. Range Minimum value: 1577808000000 Maximum value: 4102416000000 |
log_stream_id |
String |
Definition Log stream ID. Range N/A |
log_stream_name |
String |
Definition Log stream name. Range N/A |
log_stream_name_alias |
String |
Definition Log stream alias. Range N/A |
tag |
Map<String,String> |
Definition Log stream tags. Tag information of a log stream. A tag is a key-value pair. Each key is paired with its corresponding value.
|
filter_count |
Integer |
Definition Number of filters. This parameter has been brought offline. Range N/A |
hot_cold_separation |
Boolean |
Definition Whether to enable cold storage. Range
|
whether_log_storage |
Boolean |
Definition Whether to enable log storage. Range
|
auth_web_tracking |
Boolean |
Definition Whether to enable anonymous write. Range
|
ttl_in_days |
Integer |
Definition Log retention period for a log group. It determines how many days a log group's logs will be stored in LTS. Range N/A |
hot_storage_days |
Integer |
Definition Standard storage period. Range N/A |
is_favorite |
Boolean |
Definition Whether to add a log stream to favorites. Range
|
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