Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Creating a Log Transfer Task

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

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

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=UTF-8.

Default: None

Minimum: 30

Maximum: 30

Table 3 Request body parameters

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.

Minimum: 36

Maximum: 36

Array Length: 1 - 100

obs_bucket_name

Yes

String

Indicates the 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

No

String

Whether the logs are stored in raw or JSON format. The default value is RAW.

Default: RAW

Minimum: 3

Maximum: 4

Enumeration values:

  • RAW

  • JSON

switch_on

No

Boolean

Whether log transfer is enabled. The value is true (default) or false.

Default: true

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 storage period of logs in an OBS bucket. The storage period is specified by the combination of the values of period and period_unit, and must be set to one of the following: 2 min, 5 min, 30 min, 1 hour, 3 hour, 6 hour, and 12 hour.

Minimum: 1

Maximum: 30

Enumeration values:

  • 1

  • 2

  • 3

  • 5

  • 6

  • 12

  • 30

period_unit

Yes

String

Unit of the log transfer interval.Note:The combination of period and period_unit must be one of ["2min","5min","30min","1hour","3hour","6hour","12hour"].

Minimum: 3

Maximum: 4

Enumeration values:

  • "min"

  • "hour"

Response Parameters

Status code: 201

Table 4 Response body parameters

Parameter

Type

Description

log_dump_obs_id

String

Transfer task ID.

Default: None

Minimum: 36

Maximum: 36

Status code: 400

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}/log-dump/obs

/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: 200

The request is successful. The OBS transfer task has been created.

The log group does not exist.
{    
  "error_code": "LTS.0201",    
  "error_msg": "The log group does not existed"
}

The log stream does not exist.
{    
  "error_code": "LTS.0208",      
  "error_msg": "Log stream id does not exist: 632b9bdc-5afd-4666-a5de-2579f8b80314-"
}

The OBS bucket does not exist.
{    
  "error_code": "LTS.0416",    
  "error_msg": "obs bucket does not exist: zhuanchu"
}

The log stream ID has been associated with a transfer task.
{    
  "error_code": "LTS.0207",    
  "error_msg": "Log stream id is associated by transfer: 632b9bdc-5afd-4666-a5de-2579f8b80314"
}

Invalid transfer type.
{    
  "error_code": "LTS.1901",    
  "error_msg": "type is not in the list [cycle]"
}

Invalid transfer format.
{    
  "error_code": "LTS.1901",     
  "error_msg": "storage_format is not in the list [RAW, JSON]"
}

Invalid log transfer interval.
{    
  "error_code": "LTS.1901",    
  "error_msg": "period+period_unit is not in the list [2min, 5min, 30min, 1hour, 3hour, 6hour, 12hour]"
}

Invalid unit of the log transfer interval.
{    
  "error_code": "LTS.1901",    
  "error_msg": "period_unit is not in the list [min, hour]"
}

Invalid file name prefix.
{
   "error_code": "LTS.1902",
   "error_msg": "prefix_name is invalid, please verify if it's provided as required"
}

Invalid custom path to store log files.
{    
  "error_code": "LTS.1902",    
  "error_msg": "dir_prefix_name is invalid, please verify if it's provided as required"
}

Status code: 201

The request is successful.

{
  "log_dump_obs_id" : "45fdc36b-xxxx-4567-xxxx-559xxxxdf968"
}

Status code: 400

BadRequest. Invalid request. 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: 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.0202",
  "error_msg" : "Failed to query lts struct log"
}

Status Codes

Status Code

Description

200

The request is successful. The OBS transfer task has been created.

201

The request is successful.

400

BadRequest. Invalid request. Modify the request based on the description in error_msg before a retry.

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.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback