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

Querying All Log Groups of an Account

Function

This API is used to query all log groups of an account.

URI

GET /v2/{project_id}/groups

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

Request Parameters

Table 2 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=application/json;charset=UTF-8.

Default: None

Minimum: 30

Maximum: 30

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

log_groups

Array of LogGroup objects

Log group information.

Array Length: 0 - 100

Table 4 LogGroup

Parameter

Type

Description

creation_time

Number

Creation time.

log_group_name

String

Log group name.

Minimum: 1

Maximum: 64

log_group_id

String

Log group ID.

Minimum: 36

Maximum: 36

ttl_in_days

Integer

Log retention duration ().

tag

Map<String,String>

Log stream tags.

stream_size

Integer

Number of log streams in a log group.

Status code: 401

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 403

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 503

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

POST https://{endpoint}/v2/{project_id}/groups

/v2/{project_id}/groups

Example Responses

Status code: 200

The request is successful.

{
  "log_groups" : [ {
    "creation_time" : 1684916141865,
    "stream_size" : 1,
    "log_group_name" : "aom-090-002",
    "tag" : { },
    "log_group_id" : "d5c78cea-7c53-467e-b17e-344f2370b8e9",
    "ttl_in_days" : 7
  }, {
    "creation_time" : 1684720336218,
    "stream_size" : 1,
    "log_group_name" : "lts-group-lmytest-0522-2",
    "tag" : {
      "tag8" : "test8",
      "tag9" : "test9",
      "tag" : "66666@.com",
      "tag7" : "test7",
      "tag2" : "test"
    },
    "log_group_id" : "dd723a1e-43b4-4964-943c-e43fd1d1bef3",
    "ttl_in_days" : 7
  } ]
}

Status code: 401

AuthFailed. Authentication failed. Check the token and try again.

{
  "error_code" : "LTS.0003",
  "error_msg" : "Invalid token"
}

Status code: 403

Forbidden.The request is 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

InternalServerError. 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

AuthFailed. Authentication failed. Check the token and try again.

403

Forbidden.The request is 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

InternalServerError. The server has received the request but encountered an internal error.

503

ServiceUnavailable. The requested service is unavailable.

Error Codes

See Error Codes.