Creates a real-time log delivery task.
Operation description
The site plan associated with SiteId must support real-time log delivery (such as the Standard plan). Call GetSiteLogDeliveryQuota to perform a pre-check, or verify the plan level by checking the PlanName field returned by ListSites.
Try it now
Test
RAM authorization
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| BusinessType |
string |
Yes |
The business type. Valid values:
|
dcdn_log_access_l1 |
| SiteId |
integer |
Yes |
The site ID, which can be obtained by calling the ListSites operation. |
12312312112*** |
| DataCenter |
string |
No |
The data center. Valid values:
|
cn |
| TaskName |
string |
Yes |
The task name. |
dcdn-test-task |
| FieldName |
string |
Yes |
The selected log fields, separated by commas (,). Note
The field names must come from the FieldName values returned by the GetRealtimeDeliveryField operation, and the corresponding BusinessType must be specified. |
ClientIP,ClientRequestURI,EdgeResponseStatusCode |
| DeliveryType |
string |
Yes |
The delivery type. Valid values:
|
sls |
| DiscardRate |
number |
No |
The discard rate. Default value: 0. |
0.0 |
| S3Delivery |
object |
No |
The S3 or S3-compatible delivery configuration parameters. |
|
| Region |
string |
No |
The region where the service resides. |
cn-beijing |
| BucketPath |
string |
No |
The bucket path. |
logriver-test/log |
| AccessKey |
string |
No |
The AccessKey ID of the Alibaba Cloud account or RAM user. |
yourAccessKeyID |
| SecretKey |
string |
No |
The SecretKey ID used by the S3 account. |
LDSIKh*** |
| Endpoint |
string |
No |
The server endpoint. This parameter is required when S3Cmpt is set to true. Note
For S3-compatible services, configure domain name resolution by concatenating the Bucket and Endpoint addresses. For example, if Endpoint is example.com and Bucket is demo, the actual delivery address is demo.example.com. |
https://s3.oss-cn-hangzhou.aliyuncs.com |
| PrefixPath |
string |
No |
The storage path prefix. |
logriver-test/log |
| S3Cmpt |
boolean |
No |
Specifies whether the service is S3-compatible. |
true |
| ServerSideEncryption |
boolean |
No |
Specifies whether to enable S3 server-side encryption. To configure server-side encryption for the S3 bucket, refer to OSS Server-side encryption. |
false |
| VertifyType |
string |
No |
The verification method for S3 delivery keys. Note
The key configuration comes from the console or SDK. Keys from the console are encrypted during transmission. Keys from the SDK do not require encryption. Valid values:
|
console |
| OssDelivery |
object |
No |
The OSS delivery configuration. |
|
| Region |
string |
No |
The OSS region. |
cn-shanghai |
| Aliuid |
string |
No |
The Alibaba Cloud account ID. |
1234*** |
| BucketName |
string |
No |
The bucket name. |
test_rlog |
| PrefixPath |
string |
No |
The OSS storage path prefix. |
test/ |
| HttpDelivery |
object |
No |
The HTTP delivery configuration parameters. |
|
| DestUrl |
string |
No |
The HTTP server delivery address. |
http://xxx.aliyun.com/v1/log/upload |
| StandardAuthOn |
boolean |
No |
Specifies whether to use standard authentication. |
true |
| StandardAuthParam |
object |
No |
The standard authentication parameters. |
|
| PrivateKey |
string |
No |
The private key. |
*** |
| ExpiredTime |
integer |
No |
The encryption timeout period. Note
The value must be greater than 0. A value of 300 or greater is recommended. Unit: seconds. |
300 |
| UrlPath |
string |
No |
The URI path for standard authentication. |
v1/log/upload |
| MaxBatchSize |
integer |
No |
The maximum number of log entries per delivery. |
1000 |
| MaxBatchMB |
integer |
No |
The maximum size per delivery. Unit: MB. |
5 |
| MaxRetry |
integer |
No |
The maximum number of retries. |
3 |
| TransformTimeout |
integer |
No |
The timeout period. Unit: seconds. |
10 |
| LogBodyPrefix |
string |
No |
The log delivery body prefix. |
cdnVersion:1.0 |
| LogBodySuffix |
string |
No |
The log delivery body suffix. |
cdnVersion:1.0 |
| Compress |
string |
No |
The compression method. By default, no compression is applied. |
gzip |
| HeaderParam |
object |
No |
The Custom Header. |
|
|
object |
No |
The key of the Custom Header. |
||
| StaticValue |
string |
No |
The value of the custom HTTP delivery request header. Note
Key-map. The value can be a static value, a dynamic function, or a dynamic value. |
x-auth: sk-*** |
| QueryParam |
object |
No |
The custom request parameters. |
|
|
object |
No |
The key of the custom HTTP delivery query string parameter. |
||
| StaticValue |
string |
No |
The value of the custom HTTP delivery query string parameter. Note
Key-map. The value can be a static value, a dynamic function, or a dynamic value. |
auth_token: sk-*** |
| LogSplit |
boolean |
No |
Specifies whether to enable log segmentation. Default value: true. |
true |
| LastLogSplit |
boolean |
No |
The trailing separator. |
true |
| LogSplitWords |
string |
No |
The log separator. |
\n |
| KafkaDelivery |
object |
No |
The Kafka delivery configuration parameters. |
|
| Topic |
string |
No |
The Kafka message topic. |
dqc_test2 |
| UserAuth |
boolean |
No |
Specifies whether to enable user authentication. |
true |
| MachanismType |
string |
No |
The encryption method. |
plain |
| UseTLS |
boolean |
No |
Specifies whether to enable SASL-encrypted transmission for Kafka delivery. Note
The delivery address must be configured with a public certificate. Self-signed certificate verification will fail. |
false |
| UserName |
string |
No |
The username. |
xxx |
| Password |
string |
No |
The encryption password. |
*** |
| Brokers |
array |
No |
The array of servers. |
|
|
string |
No |
The list of Kafka broker servers. |
192.168.xxx.xxx:9902 |
|
| Compress |
string |
No |
The compression method. |
lz4 |
| Balancer |
string |
No |
The load balancing method. |
kafka.LeastBytes |
| SlsDelivery |
object |
No |
The Simple Log Service (SLS) delivery configuration. |
|
| SLSRegion |
string |
No |
The SLS real-time log region name. |
cn-hangzhou |
| SLSProject |
string |
No |
The SLS project name. |
dcdn-test20240417 |
| SLSLogStore |
string |
No |
The SLS Logstore name. |
accesslog-test |
| FilterVer |
string |
No |
The filter rule version. Note
For backward compatibility with legacy filter rules, the default value is v1. Newly created tasks use v2. |
v2 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response body. |
||
| RequestId |
string |
The request ID. |
9358E852-992D-5BC7-8BD7-975CA02773A8 |
| TaskName |
string |
The task name. |
er-oss |
| SiteId |
integer |
The site ID, which can be obtained by calling the ListSites operation. |
123456**** |
| DataCenter |
string |
The data center. Valid values:
|
cn |
Examples
Success response
JSON format
{
"RequestId": "9358E852-992D-5BC7-8BD7-975CA02773A8",
"TaskName": "er-oss",
"SiteId": 0,
"DataCenter": "cn"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParameter | The specified parameter is invalid. | The specified parameter is invalid. |
| 400 | RealTimeLog.ProjectExistError | The real-time log delivery task name already exists. Check the task name and try again. | The real-time log delivery task name already exists. Check the task name and try again. |
| 400 | InternalError | An internal exception occurred, please try again later. | An inner exception was triggered. Please try again later. |
| 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.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.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 |
| 403 | RealTimeLog.SlrRoleCheckError | Your account does not have AliyunServiceRoleForESARealtimeLogPushSLS authorization. Please contact the main account or permission administrator to authorize the current user AliyunServiceRoleForESARealtimeLogPushSLS permission or create custom permissions and policies for service-associated roles. | You do not have permissions to create a service-linked role. Contact your Alibaba Cloud account or the permission administrator to attach the AliyunESAFullAccess policy or a custom policy that grants permissions to create a service-linked role to the current user. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.