Creating a Log Group
Function
This API is used to create a log group.
URI
POST /v2/{project_id}/groups
Parameter | Mandatory | Type | Description |
|---|---|---|---|
project_id | Yes | String | Project ID. For details about how to obtain it, see Obtaining a Project ID. |
Request Parameters
Parameter | Mandatory | Type | Description |
|---|---|---|---|
X-Auth-Token | Yes | String | User token obtained from IAM. For details about how to obtain it, see Obtaining a User Token. |
Content-Type | Yes | String | Set this parameter to application/json;charset=UTF-8. |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
log_group_name | Yes | String | Name of the log group to be created. Configuration rules: A name can contain 1 to 64 characters. Use only letters, digits, underscores (_), hyphens (-), and periods (.). Do not start with a period or underscore or end with a period. |
ttl_in_days | Yes | Integer | Log retention period. |
tags | No | Array of TagsBody objects | Tag field information. |
Response Parameters
Status code: 201
Parameter | Type | Description |
|---|---|---|
log_group_id | String | ID of the log group to be created. |
Status code: 400
Parameter | Type | Description |
|---|---|---|
error_code | String | Error code. |
error_msg | String | Error message. |
Status code: 401
Parameter | Type | Description |
|---|---|---|
error_code | String | Error code. |
error_msg | String | Error message. |
Status code: 403
Parameter | Type | Description |
|---|---|---|
error_code | String | Error code. |
error_msg | String | Error message. |
Status code: 500
Parameter | Type | Description |
|---|---|---|
error_code | String | Error code. |
error_msg | String | Error message. |
Status code: 503
Parameter | Type | Description |
|---|---|---|
error_code | String | Error code. |
error_msg | String | Error message. |
Example Requests
Create a log group.
POST https://{endpoint}/v2/{project_id}/groups
/v2/{project_id}/groups
{
log_group_name: "lts-group-01nh",
ttl_in_days: 7
} Example Responses
Status code: 201
The request is successful and the log group has been created.
{
"log_group_id" : "b6b9332b-091f-4b22-b810-264318d2d664"
} Status code: 400
The request is invalid. Modify the request based on the description in error_msg before a retry.
{
"error_code" : "LTS.0009",
"error_msg" : "Failed to validate the request body"
} Status code: 401
Authentication failed. Check the token and try again.
{
"error_code" : "LTS.0003",
"error_msg" : "Invalid token"
} Status code: 403
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
The server has received the request but encountered an internal error.
{
"error_code" : "LTS.0102",
"error_msg" : "Failed to create log group"
} Status Codes
Status Code | Description |
|---|---|
201 | The request is successful and the log group has been created. |
400 | The request is invalid. Modify the request based on the description in error_msg before a retry. |
401 | Authentication failed. Check the token and try again. |
403 | 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 | The server has received the request but encountered an internal error. |
503 | The requested service is unavailable. |
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.

