Real-time log delivery collects logs generated by specified accelerated domain names in designated regions. These logs are delivered to Simple Log Service (SLS) for analysis to help you quickly monitor and troubleshoot issues.
Before you begin
Ensure you have activated Simple Log Service (SLS).
FAQ
How do I migrate real-time logs for a CDN domain to a different Logstore or a new Alibaba Cloud account?
The process depends on whether you are migrating within the same account or to a new one.
Migrating to a different Logstore within the same account
Simply modify the existing real-time log delivery task to point to the new Logstore (e.g., from logstore1 to logstore2). Data delivery will continue to the old Logstore until the change is fully propagated, after which it will switch to the new Logstore without interruption.
Migrating a domain to a different Alibaba Cloud account
To prevent data loss and incorrect billing, you must follow these steps in order:
In Account 1, disable the real-time log delivery task for the domain.
Migrate the domain from Account 1 to Account 2.
In Account 2, create a new real-time log delivery task for the domain.
If you fail to disable the task in Account 1, logs will continue to be delivered to its Logstore, and Account 1 will continue to be charged.
Is it possible to temporarily pause and later resume real-time log delivery?
Yes. You can pause and resume log delivery for a specific domain or Logstore without losing your configuration. The association between the domain and the Logstore is preserved while paused.
You can use the following API operations or the equivalent options in the console:
To pause delivery: Call
DisableRealtimeLogDelivery.To resume delivery: Call
EnableRealtimeLogDelivery.
How can I query the CDN log data after it has been delivered to SLS?
All queries must be performed directly within the destination Simple Log Service (SLS) Project and Logstore. Once the data is in SLS, you can:
Query all log data for a specific user within a defined time range.
Query all data delivered to a particular Logstore.
Procedure
Log on to the CDN console.
In the left-side navigation pane, choose .
On the Real-time Logging tab, click Activate Real-Time Log Push Service.
In the Create Real-time Log Delivery Task dialog box, configure the SLS parameters.

Parameter
Description
Project Name
The name of the SLS Project. The name must be unique across all your Projects in the SLS console.
Logstore Name
A Logstore is a resource collection within a Project. All data in a Logstore originates from the same data source. Queries, analysis, and delivery of collected log data are performed on a per-Logstore basis. If you leave this field empty, Alibaba Cloud CDN automatically generates a name for the Logstore.
Region
The Region where the destination SLS Logstore is located.
Log Service Role
Click Authorize. Go to the Resource Access Management (RAM) page to grant the AliyunCDNLogArchiveRole permission.
Once authorized, click Next.
Select and associate one or more domain names. Then, select the checkbox to acknowledge the billing details and click Create.
NoteThe real-time log delivery list displays only the Logstores associated with your Alibaba Cloud CDN domain names, not all Logstores in your account.
You can associate up to five domain names at a time.
After data is delivered to the Logstore, you can view four default reports. You can access these reports directly from the Alibaba Cloud CDN console.
Click OK.
On the task tab, you can view the number of successful and failed log delivery attempts.

Best practices
To learn how to use the log analysis module and perform common user access analyses, see Deliver real-time logs from Alibaba Cloud CDN to SLS for user access analysis.
Related APIs
You can call the following API operations to manage real-time log delivery.
API operation | Description |
Creates a real-time log delivery task for a domain name. | |
Queries the real-time log delivery information for a domain name. | |
Queries the number of log delivery attempts. | |
Disables real-time log delivery for a domain name. | |
Enables real-time log delivery for a domain name. | |
Queries all domain names associated with the real-time log delivery service. | |
Modifies the real-time log delivery configuration for a domain name. A domain name can deliver logs to only one Logstore at a time. | |
Queries information about all real-time log delivery service configurations. | |
Deletes a real-time log delivery task for a domain name. |