Creates a log delivery task to ship logs to the specified destination.
Operation description
This API operation allows you to deliver logs to destinations such as Simple Log Service (SLS), HTTP servers, Object Storage Service (OSS), Amazon Simple Storage Service (S3), and Kafka. You can specify the task name, log fields to deliver, data center, discard rate, delivery type, and delivery details.
- Field filtering: Use the
FieldNameparameter to specify log fields to deliver. - Filtering rules: Use the
FilterRulesparameter to pre-process and filter log data. - Diverse delivery destinations: Logs can be delivered to different destinations. Configuration parameters vary with delivery destinations.
Precautions
- Make sure that you have sufficient permissions to perform delivery tasks.
- If you enable encryption or authentication, properly configure corresponding parameters.
- Verify the syntax of
FilterRulesto make sure that filtering logic works as expected. - Specify advanced settings such as the number of retries and timeout period based on your needs to have optimal delivery efficiency and stability.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- For mandatory resource types, indicate with a prefix of * .
- If the permissions cannot be granted at the resource level,
All Resourcesis used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
| Operation | Access level | Resource type | Condition key | Associated operation |
|---|---|---|---|---|
| esa:CreateUserDeliveryTask | create | *All Resources * |
| none |
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| BusinessType | string | Yes | The log category. Valid values:
| dcdn_log_access_l1 |
| DataCenter | string | Yes | The data center. Valid values:
| cn |
| TaskName | string | Yes | The task name. | test_project |
| FieldName | string | Yes | The log field. If you specify multiple fields, separate them with commas (,). | user_agent,ip_address,ip_port |
| DeliveryType | string | Yes | The destination of the delivery. Valid values:
| sls |
| DiscardRate | float | No | The discard rate. Default value: 0. | 0 |
| S3Delivery | object | No | The configurations for delivery to Amazon S3 or an S3-compatible service. | |
| Region | string | No | The region ID of the service. | cn-shanghai |
| BucketPath | string | No | The directory in the bucket. | logriver-test/log |
| AccessKey | string | No | The access key ID of your Amazon S3 account. | g0f46623ll0g0 |
| SecretKey | string | No | The secret access key of your Amazon S3 account. | *** |
| Endpoint | string | No | The endpoint. | https://s3.oss-cn-hangzhou.aliyuncs.com |
| PrefixPath | string | No | The prefix of the path in which you want to store logs. | logriver-test/log |
| S3Cmpt | boolean | No | Specifies whether the service is compatible with Amazon S3. | true |
| OssDelivery | object | No | The configurations for delivery to OSS. | |
| Region | string | No | The region in which the bucket is located. | cn-shanghai |
| Aliuid | string | No | The ID of your Alibaba Cloud account. | 1234*** |
| BucketName | string | No | The name of the OSS bucket. | test_rlog |
| PrefixPath | string | No | The prefix of the path in which you want to store logs. | logriver-test/log |
| HttpDelivery | object | No | The configurations for delivery to an HTTP server. | |
| DestUrl | string | No | The address of the HTTP server. | http://xxx.aliyun.com/v1/log/upload |
| StandardAuthOn | boolean | No | Specifies whether to use server authentication. | true |
| StandardAuthParam | object | No | The authentication configurations. | |
| PrivateKey | string | No | The private key. | xxxx |
| ExpiredTime | integer | No | The validity period of the signature. | 300 |
| UrlPath | string | No | The URL path. | v1/log/upload |
| MaxBatchSize | long | No | The maximum number of entries for each delivery. | 1000 |
| MaxBatchMB | long | No | The maximum size of data for each delivery. Unit: MB. | 5 |
| MaxRetry | long | No | The maximum number of retries. | 3 |
| TransformTimeout | long | No | The timeout period. Unit: seconds. | 10 |
| LogBodyPrefix | string | No | The prefix of the log delivery package. | cdnVersion:1.0 |
| LogBodySuffix | string | No | The suffix of the log delivery package. | cdnVersion:1.0 |
| MinBackoffMS | long | No | The minimum backoff time. Unit: milliseconds. | 100 |
| MaxBackoffMS | long | No | The maximum backoff time. Unit: milliseconds. | 1000 |
| Compress | string | No | The compression method. | gzip |
| LogSplit | string | No | Specifies whether to enable log splitting. Default value: true. | true |
| LastLogSplit | string | No | The ending separator. | \n |
| LogSplitWords | string | No | The log separator. | \n |
| ResponseBodyKey | string | No | The response field key used for success check. | err_code |
| SuccessCode | long | No | The custom code for a success. | 200 |
| HeaderParam | object | No | The custom headers. | |
| object | No | The name of the custom header. | ||
| StaticValue | string | No | The value of the custom header. | aliyun |
| QueryParam | object | No | The custom query parameters. | |
| object | No | The name of the custom query parameter. | ||
| StaticValue | string | No | The value of the custom query parameter. | v1.1 |
| KafkaDelivery | object | No | The configurations for delivery to Kafka. | |
| Topic | string | No | The topic. | dqc_test2 |
| UserAuth | boolean | No | Specifies whether to enable authentication. | true |
| MachanismType | string | No | The encryption method. | plain |
| UserName | string | No | The username. | xxx |
| Password | string | No | The password. | xxx |
| Brokers | array | No | The brokers. | |
| string | No | The Kafka brokers. | 192.168.0.1:9902 | |
| Compress | string | No | The compression method. By default, data is not compressed. | gzip |
| Balancer | string | No | The load balancing method. | kafka.LeastBytes |
| SlsDelivery | object | No | The configurations for delivery to SLS. | |
| SLSRegion | string | No | The region in which the SLS project resides. | cn-hangzhou |
| SLSProject | string | No | The name of the SLS project. | dcdn-test20240417 |
| SLSLogStore | string | No | The name of the SLS Logstore. | accesslog-test |
Response parameters
Examples
Sample success responses
JSONformat
{
"RequestId": "2CCD40B1-3F20-5FF0-8A67-E3F34B87744F",
"TaskName": "er-http",
"DataCenter": "cn",
"Status": "online"
}Error codes
| HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 400 | InternalError | An internal exception occurred, please try again later. | An inner exception was triggered. Please try again later. |
| 400 | InvalidParameter | Invalid parameter. Check the parameter configuration. | Invalid parameter. Check the parameter configuration. |
| 403 | ErService.NotOpen | Er service has not opend. | Er service has not opend. |
| 403 | RealTimeLog.S3EndpointInvalidError | Invalid S3 information for the delivery task. Check your configurations and try again. | Invalid S3 information for the delivery task. Check your configurations and try again. |
| 403 | RealTimeLog.KafkaBrokersExceedError | The number of Kafka Broker addresses for real-time log delivery has reached the upper limit (50). | The number of Kafka Broker addresses for real-time log delivery has reached the upper limit (50). |
| 403 | RealTimeLog.StatusQuotaError | The maximum number of real-time log delivery tasks has been reached. Check your plan quota and upgrade the plan to request a quota increase. | The maximum number of real-time log delivery tasks has been reached. Check your plan quota and upgrade the plan to request a quota increase. |
| 403 | EsaService.NotOpen | ESA service has not opend. | Edge Security Accelerator (ESA) is not turned on |
For a list of error codes, visit the Service error codes.
Change history
| Change time | Summary of changes | Operation |
|---|---|---|
| 2024-12-26 | The Error code has changed. The request parameters of the API has changed | View Change Details |
| 2024-10-18 | The Error code has changed | View Change Details |
| 2024-09-27 | The Error code has changed | View Change Details |
| 2024-09-24 | The Error code has changed | View Change Details |
