Help Center/ Log Tank Service/ API Reference/ APIs/ Log Stream Management/ Querying All Log Streams in a Specified Log Group
Updated on 2025-08-21 GMT+08:00

Querying All Log Streams in a Specified Log Group

Function

This API is used to query all log streams in a specified log group. You can obtain the details about these log streams and their log events, addressing various log management needs.

Calling Method

For details, see Calling APIs.

URI

GET /v2/{project_id}/groups/{log_group_id}/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

log_group_id

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

Request Parameters

Table 2 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 3 Response body parameters

Parameter

Type

Description

log_streams

Array of LogStreamResBody objects

Definition

Log stream configuration information.

Table 4 LogStreamResBody

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

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.

whether_log_storage

Boolean

Definition

Whether to enable log storage.

Range

  • true: enables log storage.

  • false: disables log storage.

hot_cold_separation

Boolean

Definition

Whether to enable cold storage.

Range

  • true: enables cold storage.

  • false: disables cold 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. If the value is set to -1, the log stream inherits the storage period from its log group by default.

hot_storage_days

Integer

Definition

Standard storage period.

Range

N/A. If the value is set to -1, cold and hot storage is disabled for the log stream.

Status code: 401

Table 5 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: 403

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

Query all log streams in a specified log group.

GET https://{endpoint}/v2/{project_id}/groups/{log_group_id}/streams

/v2/{project_id}/groups/{log_group_id}/streams

Example Responses

Status code: 200

The request is successful.

{
  "log_streams" : [ {
    "log_stream_name_alias" : "3",
    "creation_time" : 1723102152593,
    "auth_web_tracking" : false,
    "log_stream_name" : "3",
    "is_favorite" : false,
    "hot_storage_days" : -1,
    "tag" : {
      "_sys_enterprise_project_id" : "0"
    },
    "hot_cold_separation" : false,
    "filter_count" : 0,
    "log_stream_id" : "667293b4-7f6d-4efb-9b30-xxxxxxx",
    "ttl_in_days" : -1,
    "whether_log_storage" : true
  }, {
    "log_stream_name_alias" : "5",
    "creation_time" : 1723102172632,
    "auth_web_tracking" : false,
    "log_stream_name" : "5",
    "is_favorite" : false,
    "hot_storage_days" : -1,
    "tag" : {
      "_sys_enterprise_project_id" : "0"
    },
    "hot_cold_separation" : false,
    "filter_count" : 0,
    "log_stream_id" : "fb08a859-69ed-4bbe-9ba0-xxxxxxxx",
    "ttl_in_days" : -1,
    "whether_log_storage" : true
  } ]
}

Status code: 401

Authentication failed. Check the token and try again.

{
  "error_code" : "LTS.0003",
  "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.0010",
  "error_msg" : "The system encountered an internal error"
}

Status Codes

Status Code

Description

200

The request is successful.

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.

Error Codes

See Error Codes.