Real-time log delivery lets you collect logs generated for a specified accelerated domain name in a specified region in real time, and deliver them to Log Service (SLS) for analysis. This helps you monitor and troubleshoot issues faster.
Prerequisites
Before you use this feature, ensure you have activated Log Service.
Key concepts
-
Domain name migration: If you need to migrate data for domain A from Logstore1 to Logstore2, data continues to be delivered to Logstore1 until the migration is complete. After a successful migration, data is delivered directly to Logstore2 without interruption.
ImportantIf you need to migrate domain A from account 1 to account 2, you must first disable real-time log delivery for domain A in account 1. After domain A is migrated to account 2, you must create a new real-time log delivery configuration for it in account 2. If you do not disable and then re-create the configuration, delivery to account 1 continues, and you will be charged accordingly.
-
Pausing and resuming the service: The association between a Logstore and a domain name remains even when the service is paused. You can stop or start data delivery for a specific Logstore or domain name.
-
Data query: You can query the total data for a user over a specific period or the data delivered to a specific Logstore.
Procedure
-
Log on to the CDN console.
-
In the left-side navigation pane, choose Logs > Real-time Logs.
-
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 Log Service parameters.
By default, the log retention period is 7 days, the number of shards is 2, and the number of automatic splits is 16.
Parameter
Description
Project name
The name of the Project created for Log Service in CDN. The name must be unique in the Log Service console.
Logstore name
A Logstore is a resource collection within a Project that holds data from a single data source. Queries, analysis, and delivery are performed at the Logstore level. If you do not specify a Logstore name, CDN generates one by default.
Region
The region of the destination Log Service (SLS) Logstore.
Log Service authorization
Clicking Authorize redirects you to the Resource Access Management (RAM) console. Click Agree to authorization to grant the AliyunCDNLogArchiveRole permission to your account.
-
After successful authorization, click Next.
-
Select the associated domain name, select the fee notice checkbox, and then click Create.
Note-
The CDN real-time log delivery list shows only the Logstores managed for 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, which you can open directly from the CDN console.
-
-
Click OK.
On the Real-time Log Data tab, review the delivery attempts. This page shows the creation status (succeeded or failed) for each domain name. After confirming that all domain names have a Succeeded status, click Complete.
Best practices
To learn how to use the log analysis module for real-time log delivery and how to perform common analyses of user access data, see Deliver CDN real-time logs to SLS to analyze user access data.
API reference
You can also use the API to enable real-time log delivery.
|
API |
Description |
|
Creates a real-time log delivery configuration for a domain name. |
|
|
Queries the real-time log delivery information for a domain name. |
|
|
Queries the number of real-time 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 a 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 services. |
|
|
Deletes a domain name from a real-time log delivery configuration. |