Updated on 2025-08-21 GMT+08:00

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

Table 1 Path Parameters

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

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

log_group_name

No

String

Definition

Log group name.

Constraints

N/A

Range

  • Use only letters, digits, hyphens (-), underscores (_), and periods (.). Do not start with a period or underscore or end with a period.

  • Enter 1 to 64 characters.

  • Each log group name must be unique.

Default Value

N/A

log_stream_name

No

String

Definition

Log stream name.

Constraints

N/A

Range

  • Use only letters, digits, hyphens (-), underscores (_), and periods (.). Do not start with a period or underscore or end with a period.

  • Enter 1 to 64 characters.

  • Each log stream name must be unique.

Default Value

N/A

Request Parameters

Table 3 Request header 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

Table 4 Response body parameters

Parameter

Type

Description

log_streams

Array of LogStreamNoIsFavorite objects

Definition

Log stream configuration information.

Table 5 LogStreamNoIsFavorite

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.

  • Key: Each tag key must be unique. It can contain up to 128 characters, including letters, digits, spaces, and the following special characters: _.:=+-@. It cannot start or end with a space or start with sys.

  • Value: It can contain up to 255 characters, including letters, digits, spaces, and the following special characters: _.:=+-@

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

  • true: enables cold storage.

  • false: disables cold storage.

whether_log_storage

Boolean

Definition

Whether to enable log storage.

Range

  • true: enables log storage.

  • false: disables log storage.

auth_web_tracking

Boolean

Definition

Whether to enable anonymous write.

Range

  • true: enables anonymous write.

  • false: disables anonymous write.

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

  • true: adds the log stream to favorites.

  • false: does not add log streams to favorites.

Status code: 400

Table 6 Response body parameters

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

Table 7 Response body parameters

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.