Dynamic Route for CDN (DCDN) supports the log storage feature, which is integrated with Object Storage Service (OSS) and Data Lake Analytics (DLA). After the log storage feature is enabled, DCDN logs are automatically persisted to a specified OSS bucket. You can use DLA to analyze these logs. This topic describes how to enable log storage.

Prerequisites

You must activate OSS and DLA before you can enable log storage. You can use the following methods to activate these services:

Background information

When you enable log storage, the system automatically creates the service-linked role AliyunServiceRoleForDCDNLogDelivery and grants the role permissions on OSS and DLA. This allows DCDN to automate log storage. For more information about the service-linked role, see SLR for log delivery.

Billing rules

After log storage is enabled, you are charged for OSS and DLA separately.
  • For more information about the billing rules of OSS, see OSS pricing.
  • For more information about the billing rules of DLA, see Billing methods.
    Notice After log storage is enabled, logs are delivered by DLA. You are charged for DLA no matter whether you use DLA to analyze data.

Procedure

Notice
  • Logs are collected from DCDN nodes and then directly delivered to the OSS bucket. The integrity of log data is not guaranteed. If you want to acquire complete log data, we recommend that you download logs on the Log Download tab. Make sure that the fields that you specify are the same as those in the logs.
  • By default, Resource Access Management (RAM) users are not allowed to enable or manage log storage. You must first grant the RAM users the required permissions. For more information, see Grant a RAM user permissions on log storage.
  • If you want to grant a RAM user permissions to manage log storage, make sure that the authorized scope is set to Alibaba Cloud Account. For more information, see Step 2: Grant permissions to the RAM user.
  • If you want to manage log storage as a RAM user, make sure that the authorized scope of the RAM user is set to Alibaba Cloud Account. Otherwise, log storage may be disabled for some domain names.
  1. Log on to the DCDN console.
  2. In the left-side navigation pane, choose Logs > Offline Log.
  3. Click the Log Storage tab.
  4. Click Activate Now.
  5. Set Storage Region.
    1. In the Activate Log Storage dialog box, set Storage Region.
      Note
      • An OSS bucket is created in the specified region. DCDN logs are stored in this OSS bucket.
      • The region cannot be changed.
      • If log storage is already enabled in Alibaba Cloud CDN with a region specified, you cannot specify a region when you enable log storage in DCDN. By default, the same region is selected for the log storage feature in Alibaba Cloud CDN and DCDN.
      Service country and region Storage country and region Description
      Mainland China
      • China (Shanghai)
      • China (Beijing)
      • China (Hangzhou)
      The China (Shanghai), China (Beijing), and China (Hangzhou) regions are supported. Select a region to meet your business requirements.
      Other countries and regions Singapore (Singapore) Only this region is supported.
      India India (Mumbai) Only this region is supported.
      Europe Germany (Frankfurt) Only this region is supported.
      US US (Silicon Valley) Only this region is supported.
    2. Click Activate Data Lake Analytics and go to the next step.
  6. Set Transfer Rule.
    1. In the Activate Log Storage dialog box, specify Transfer Field and select the accelerated domain names for which you want to enable log storage.
      Note You can view and select at most 500 domain names in the console. If you want to enable log storage for more domain names, submit a ticket.
      You can specify one or more log fields. The log fields cannot be modified after they are specified. The following table describes the supported fields.
      Field Description Example
      contentType Indicates file types. text/html
      domain Indicates accelerated domain names. www.aliyun.com
      hitInfo Indicates cache hit ratios. hit
      http2 Indicates the HTTP/2 protocol. HTTP2
      httpCode Indicates HTTP status codes. 504,404,302,200
      method Indicates request methods. Valid values: GET and POST. GET or POST
      refer Indicates the referer header in HTTP requests. "-"
      remoteIP Indicates the IP address of the client that initiated the request. 192.168.15.75
      reqSize Indicates the size of the request. Unit: bytes. 129
      respSize Indicates the size of the response. Unit: bytes. 129
      rt Indicates the response time. Unit: milliseconds. 1
      schema Indicates the protocol over which the request was transmitted. HTTP and HTTPS are supported. HTTP or HTTPS
      traceID Indicates the unique ID of the request. d35ba34115550716522547264e
      ua Indicates the information about the proxy of the client. Mozilla/5.0 (compatible; AhrefsBot/5.0; +http://ahrefs.com/robot/)
      unixtime Indicates the timestamp of the request. Unit: seconds. 1607340145
      urlPath Indicates the Uniform Resource Identifier (URI) of the request. No domain name information is included. /index.html
      urlRawQuery Indicates the query parameters that follow the question mark (?)in the request URI. x=1&y=1
      userlnfo Indicates custom fields. No
    2. Click Activate.

      If you want to modify log delivery rules after you enable log storage or disable this feature, you can perform relevant operation on the Log Storage tab.

      After log storage is disabled, you can delete the service-linked role AliyunServiceRoleForDCDNLogDelivery. For more information, see Delete AliyunServiceRoleForDCDNLogDelivery.

References

After log storage is enabled and logs are generated, you can run SQL statements by using the serverless Presto engine to analyze logs in DLA. For more information, see Analyze DCDN logs.

FAQ

What is the format of the log files that are delivered to OSS after log storage is enabled?

After you enable log storage, the system delivers Optimized Row Columnar (ORC) files to OSS. If you want to analyze log data, we recommend that you use DLA. You can run SQL statements by using the serverless Presto engine to analyze logs in DLA. For more information, see Analyze DCDN logs.