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 automatically stores logs in a specified OSS bucket, which allows you to store logs for an extended period of time. Then, you can use DLA to analyze the logs. This topic describes how to enable log storage.

Prerequisites

Before you enable log storage, make sure that you have completed the following operations:

  • OSS is activated. To activate OSS, go to the product page of OSS.
  • DLA is activated. To activate DLA, go to the product page of DLA.
  • DLA and OSS are enabled in the region where you want to store logs because log storage uses DLA to deliver logs and uses OSS to store logs.

Background information

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

Billing

After log storage is enabled, you are charged for both OSS and DLA.
  • 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 even if you do not use DLA to analyze data.

Procedure

Notice
  • Logs are collected from DCDN nodes and then directly delivered to the OSS bucket. Log integrity is not guaranteed. If you want to acquire complete log data, we recommend that you go to the Log Download tab to download logs. Make sure that the fields that you specify are the same as those in the logs.
  • By default, 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. Configure Storage Region .
    1. In the Activate Log Storage dialog box, set Storage Region.
      Note
      • After log storage is enabled, an OSS bucket is created in the specified region to store DCDN logs.
      • The region cannot be changed after the bucket is created.
      • If log storage is enabled in Alibaba Cloud CDN and a region is specified, you cannot specify a different 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)
      Three storage regions are supported: China (Shanghai), China (Beijing), and China (Hangzhou). Select a region based on your business requirements.
      Other countries and regions 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. Configure Transfer Rule.
    1. In the Activate Log Storage dialog box, set Transfer Field, and select the accelerated domain names for which you want to enable log storage.
      Note You can view and select up to 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 transfer fields. The transfer fields cannot be modified after they are specified. The following table describes the supported fields.
      Field Description Example
      contentType Specifies a file type. text/html
      domain Specifies an accelerated domain name. www.aliyun.com
      hitInfo Specifies cache hit information. hit
      http2 Specifies the HTTP/2 protocol. HTTP2
      httpCode Specifies HTTP status codes. 504 , 404 , 302 , 200
      method Specifies request methods. Valid values: GET and POST. GET and POST
      refer Specifies the referer header in HTTP requests. "-"
      remoteIP Specifies the IP address of the client that initiated the request. 192.168.15.75
      reqSize Specifies the size of the request. Unit: bytes. 129
      respSize Specifies the size of the response. Unit: bytes. 129
      rt Specifies the response time. Unit: milliseconds. 1
      schema Specifies the protocol over which the request was transmitted. Valid values: HTTP and HTTPS. HTTP and HTTPS
      traceID Specifies the unique ID of the request. d35ba34115550716522547264e
      ua Specifies the information about the proxy of the client. Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36
      unixtime Specifies the timestamp of the request. Unit: seconds. 1607340145
      urlPath Specifies the Uniform Resource Identifier (URI) of the request. No domain name information is included. /index.html
      urlRawQuery Specifies the query parameters that follow the question mark (?) in a URL. x=1&y=1
      userlnfo Specifies custom log fields. None
    2. Click Activate.

      After you enable log storage, you can modify log storage rules or disable log storage on the Log Storage tab.

      After log storage is disabled, you can delete the AliyunServiceRoleForDCDNLogDelivery SLR. 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 files that are delivered to OSS after log storage is enabled?

Files delivered to OSS are in the Optimized Row Columnar (ORC) format. We recommend that you use DLA to analyze ORC files. You can run SQL statements by using the serverless Presto engine to analyze logs in DLA. For more information, see Analyze DCDN logs.