Updated on 2024-04-12 GMT+08:00

Querying Log Streams

Function

This API is used to query log streams.

URI

GET /v2/{project_id}/log-streams

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain a project ID, see Obtaining the Account Tenant ID, Log Group ID, and Log Stream ID.

Default: None

Minimum: 32

Maximum: 32

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

log_group_name

No

String

Log group name.

Minimum: 1

Maximum: 64

log_stream_name

No

String

Log stream name.

Minimum: 1

Maximum: 64

offset

No

Integer

Query cursor. Set the value to 0 in the first query. In subsequent queries, obtain the value from the response to the last request.

Minimum: 0

Maximum: 1024

limit

No

Integer

Number of records on each page. The maximum value is 100.

Minimum: 0

Maximum: 100

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token obtained from IAM.

Default: None

Minimum: 1000

Maximum: 2000

Content-Type

Yes

String

Set this parameter to application/json;charset=UTF-8.

Default: None

Minimum: 30

Maximum: 30

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

log_streams

Array of LogStream objects

List of log groups.

Array Length: 0 - 100

Table 5 LogStream

Parameter

Type

Description

creation_time

Long

Creation time.

log_stream_name

String

Log stream name.

Minimum: 1

Maximum: 64

log_stream_id

String

Log stream ID.

Minimum: 36

Maximum: 36

filter_count

Integer

Number of filters.

Minimum: 0

Maximum: 5

tag

Map<String,String>

Log stream tags.

is_favorite

Boolean

Indicates whether to favorite the media asset.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum: 8

Maximum: 8

error_msg

String

Error message.

Minimum: 1

Maximum: 1000

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum: 8

Maximum: 8

error_msg

String

Error message.

Minimum: 1

Maximum: 1000

Example Requests

If no parameter is specified, all log streams are returned. 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=lts-group-txxxx
/v2/{project_id}/log-streams?log_stream_name=lts-xunjian-topic-xxxx 
/v2/{project_id}/log-streams?log_stream_name=lts-xunjian-topic-xxxx&log_group_name=lts-group-xxx

Example Responses

Status code: 200

Log stream information is returned.

{
  "log_streams" : [ {
    "creation_time" : 1684725311230,
    "log_stream_name" : "lts-xxxx-lmytest-0522-12",
    "is_favorite" : true,
    "tag" : {
      "_sys_enterprise_project_id" : "0",
      "tag" : "66666@.com",
      "tag5" : "test5"
    },
    "filter_count" : 0,
    "log_stream_id" : "f5fdce2d-xxxx-4689-8b8a-90d269f7db76"
  } ]
}

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.