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

Querying Logs

Function

This API is used to query logs.

Constraints

This API has the following constraints:

  • Parameters marker, limit, and page_reverse are used for pagination query.

  • Parameters marker and page_reverse take effect only when they are used together with parameter limit.

Calling Method

For details, see Calling APIs.

URI

GET /v3/{project_id}/elb/logtanks

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition: Specifies the project ID. For details about how to obtain a project ID, see Obtaining a Project ID.

Constraints: N/A

Range: The value can contain a maximum of 32 characters, including digits and lowercase letters.

Default value: N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

limit

No

Integer

Definition: Specifies the number of records returned on each page.

Constraints: N/A

Range: 0 to 2000

Default value: 2000

marker

No

String

Definition: Specifies the ID of the last record on the previous page.

Constraints:

  • This parameter must be used together with limit.

  • If the parameter is not specified, only resources on the first page are queried.

  • This parameter cannot be left blank or set to an invalid ID.

Range: N/A

Default value: N/A

page_reverse

No

Boolean

Definition: Specifies whether to use reverse query.

Constraints:

  • This parameter must be used together with limit.

  • If page_reverse is set to true and you want to query the resources on the previous page, set the value of marker to the value of previous_marker.

Range:

  • true: Query resources on the previous page.

  • false: Query resources on the next page.

Default value: false

enterprise_project_id

No

Array of strings

Definition: Specifies the ID of the enterprise project.

Multiple values can be used for query in the format of:

enterprise_project_id=xxx&enterprise_project_id=xxx.

Constraints:

  • If enterprise_project_id is not specified, resources in all enterprise projects are queried by default. Fine-grained authorization is performed. The elb:logtanks:list permission must be assigned to the user group.

  • If enterprise_project_id is specified, the value can be a specific enterprise project ID or all_granted_eps. If the value is a specific enterprise project ID, only resources in the enterprise project are queried. If the value is all_granted_eps, resources in the enterprise projects with the elb:logtanks:list permission are queried.

Range: N/A

Default value: N/A

id

No

Array of strings

Specifies the ID of the log tank.

Multiple IDs can be used for query in the format of id=xxx&id=xxx.

loadbalancer_id

No

Array of strings

Specifies the ID of a load balancer.

Multiple IDs can be used for query in the format of loadbalancer_id=xxx&loadbalancer_id=xxx.

log_group_id

No

Array of strings

Specifies the log group ID.

Multiple IDs can be used for query in the format of log_group_id=xxx&log_group_id=xxx.

log_topic_id

No

Array of strings

Specifies the log topic ID.

Multiple IDs can be used for query in the format of log_topic_id=xxx&log_topic_id=xxx.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition: Specifies the token used for IAM authentication.

Constraints: N/A

Range: N/A

Default value: N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

logtanks

Array of Logtank objects

Provides supplementary information.

page_info

PageInfo object

Definition: Specifies the pagination information.

request_id

String

Definition: Specifies the request ID.

Range: The value is automatically generated, and can contain characters including digits, lowercase letters, and hyphens (-).

Table 5 Logtank

Parameter

Type

Description

id

String

Specifies the log ID.

project_id

String

Definition: Specifies the project ID. For details about how to obtain a project ID, see Obtaining a Project ID.

Range: The value can contain a maximum of 32 characters, including digits and lowercase letters.

loadbalancer_id

String

Specifies the load balancer ID.

log_group_id

String

Specifies the log group ID.

log_topic_id

String

Specifies the log topic ID.

Table 6 PageInfo

Parameter

Type

Description

previous_marker

String

Definition: Specifies the ID of the first record in the pagination query result. If page_reverse is set to true, this parameter is used together to query resources on the previous page.

Range: N/A

next_marker

String

Definition: Specifies the ID of the last record in the pagination query result. It is usually used to query resources on the next page.

Range: N/A

current_count

Integer

Definition: Specifies the number of records returned on the current page.

Range: N/A

Example Requests

Querying logs of multiple load balancers

GET https://{ELB_Endpoint}/v3/060576798a80d5762fafc01a9b5eedc7/elb/logtanks?loadbalancer_id=995b98d7-6010-4502-a91a-756f399088f8&loadbalancer_id=37e9c3e3-08a2-48e9-acee-431159a33cc2

Example Responses

Status code: 200

OK

{
  "request_id" : "5b43d31cd5217ffca57c2c4177e1b1ee",
  "logtanks" : [ {
    "project_id" : "060576798a80d5762fafc01a9b5eedc7",
    "log_topic_id" : "5b9b8370-a1fc-4c59-a509-483a673c8a94",
    "id" : "281e8768-94f9-45e9-9f3d-9fe2a122ad67",
    "log_group_id" : "7733882e-f7fa-4fb0-a460-0605c48a2280",
    "loadbalancer_id" : "995b98d7-6010-4502-a91a-756f399088f8"
  } ],
  "page_info" : {
    "next_marker" : "281e8768-94f9-45e9-9f3d-9fe2a122ad67",
    "previous_marker" : "281e8768-94f9-45e9-9f3d-9fe2a122ad67",
    "current_count" : 1
  }
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.