Querying All Log Groups of an Account
Function
This API is used to quickly query the list and information of all log groups of a specified account, helping you fully understand log management and resource distribution in the account.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
lts:logGroup:listLogGroup
List
-
-
- lts:groups:get
- lts:groups:list
-
URI
GET /v2/{project_id}/groups
|
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 |
Request 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
|
Parameter |
Type |
Description |
|---|---|---|
|
log_groups |
Array of LogGroup objects |
Definition Log group information list. |
|
Parameter |
Type |
Description |
|---|---|---|
|
creation_time |
Long |
Definition Log group creation time. Range N/A |
|
log_group_name |
String |
Definition Log group name. Range N/A |
|
log_group_id |
String |
Definition Log group ID. Range N/A |
|
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 |
|
tag |
Map<String,String> |
Definition Log group tags. A tag is a key-value pair. Each key is paired with its corresponding value. |
|
log_group_name_alias |
String |
Log group alias. |
Status code: 401
|
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
|
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
|
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 groups of an account.
GET https://{endpoint}/v2/{project_id}/groups
/v2/{project_id}/groups
Example Responses
Status code: 200
The request is successful.
{
"log_groups" : [ {
"creation_time" : 1630547141853,
"log_group_name" : "lts-group-01nh",
"log_group_id" : "b6b9332b-091f-4b22-b810-264318d2d664",
"ttl_in_days" : 7
} ]
}
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot