Creating a Log Transfer Task (Old Version)
Function
This API is used to transfer logs of one or more specified log streams to Object Storage Service (OBS).
URI
POST /v2/{project_id}/log-dump/obs
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Project ID. For details about how to obtain a project ID, see Obtaining the Project ID, Account ID, Log Group ID, and Log Stream ID. Minimum: 32 Maximum: 32 |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | User token obtained from IAM. For details about how to obtain a user token, see Obtaining a User Token. Minimum: 1000 Maximum: 2000 |
| Content-Type | Yes | String | Set this parameter to application/json;charset=UTF-8. Minimum: 30 Maximum: 30 |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| log_group_id | Yes | String | Log group ID. Minimum: 36 Maximum: 36 |
| log_stream_ids | Yes | Array of strings | Indicates IDs of log streams whose logs are to be periodically transferred to OBS. You can specify one or more log streams. |
| obs_bucket_name | Yes | String | Name of an OBS bucket. Minimum: 3 Maximum: 63 |
| type | Yes | String | Set this parameter to cycle, which indicates that the log transfer is periodic. Minimum: 5 Maximum: 5 |
| storage_format | Yes | String | Whether the logs are stored in raw or JSON format. The default value is RAW. Minimum length: 3 characters. Maximum length: 4 characters. |
| switch_on | No | Boolean | Whether log transfer is enabled. The value is true (default) or false. |
| prefix_name | No | String | The file name prefix of the log files transferred to an OBS bucket. Minimum: 0 Maximum: 64 |
| dir_prefix_name | No | String | A custom path to store the log files. Minimum: 0 Maximum: 64 |
| period | Yes | Integer | Length of the log transfer interval. |
| period_unit | Yes | String | Unit of the log transfer interval. The combination of period and period_unit must be one of ["2min","5min","30min","1hour","3hour","6hour","12hour"]. Minimum: 3 Maximum: 4 |
Response Parameters
Status code: 201
| Parameter | Type | Description |
|---|---|---|
| log_dump_obs_id | String | Transfer task ID. |
Status code: 400
| 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. |
Example Requests
Creating a log transfer task
POST https://{endpoint}/v2/{project_id}/log-dump/obs
{
"log_group_id" : "d9dba9f3-xxxx-48bd-xxxx-xxxxa24a8053",
"log_stream_ids" : [ "45e7f609-xxxx-4cd3-835b-xxxx4a124718" ],
"obs_bucket_name" : "lts-test",
"type" : "cycle",
"storage_format" : "RAW",
"switch_on" : "true",
"prefix_name" : "fileprefixname",
"dir_prefix_name" : "dirprefixname",
"period" : 5,
"period_unit" : "min"
} Example Responses
Status code: 201
The request is successful.
{
"log_dump_obs_id" : "45fdc36b-xxxx-4567-xxxx-559xxxxdf968"
} Status code: 400
Invalid request. Modify the request based on the description in error_msg before a retry.
Invalid request. Modify the request based on the description in **error_msg** before a retry.
{
"error_code": "LTS.0007",
"error_msg": "The request body format must be json"
} Status code: 403
The request has been rejected. The server has received and understood the request but it refused to respond, because the request is set to deny access. Do not retry the request before modifying it.
{
"error_code" : "LTS.0001",
"error_msg" : "Invalid projectId"
} Status code: 500
The server has received the request but encountered an internal error.
The server has received the request but encountered an internal error.
{
"error_code": "LTS.0010",
"error_msg": "Internal Server Error"} Status Codes
| Status Code | Description |
|---|---|
| 201 | The request is successful. |
| 400 | Invalid request. Modify the request based on the description in error_msg before a retry. |
| 403 | The request has been rejected. The server has received and understood the request but it refused to respond, because the request is set to deny access. Do not retry the request before modifying it. |
| 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