All Products
Search
Document Center

CDN:Download offline logs

Last Updated:Aug 22, 2024

Alibaba Cloud CDN collects domain access logs on an hourly basis. You can download the daily log data of a domain name collected in the last 30 days to your local PC for further analysis.

Precautions

  • The traffic usage of accelerated domain names that is queried by using the Monitoring & Usage Analytics or Usage Statistics feature available in the Alibaba Cloud CDN or Dynamic Content Delivery Network (DCDN) console or by calling API operations differs from that collected in logs. Typically, the traffic usage of accelerated domain names that is queried by using the Monitoring & Usage Analytics or Usage Statistics feature is 1.1 times that collected in logs. For more information, see Why is the traffic amount found by using the Monitoring & Usage Analytics or Usage Statistics feature or the usage statistics feature different from the logged traffic amount?

  • Some Internet service providers (ISPs) may assign private IP addresses to clients in specific regions. Therefore, POPs may receive requests from private IP addresses.

    Note

    Private IP addresses are of the following types:

    • Type-A private IP addresses: 10.0.0.0 to 10.255.255.255. Subnet mask: 10.0.0.0/8.

    • Type-B private IP addresses: 172.16.0.0 to 172.31.255.255. Subnet mask: 172.16.0.0/12.

    • Type-C private IP addresses: 192.168.0.0 to 192.168.255.255. Subnet mask: 192.168.0.0/16.

Usage notes

  • Log update delay: In most cases, log data is generated within 24 hours after an event occurs. In some cases, it may take longer.

  • By default, Alibaba Cloud CDN stores log data for 30 days. If you want to retain log data for a longer period of time, you can use the log storage feature to store log data to an Object Storage Service (OSS) bucket. For more information, see Use Function Compute to deliver logs.

  • Naming rule for log files: Accelerated domain name_year_month_day_start time_end time[extension field].gz. The extension field starts with an underscore (_). Example: aliyundoc.com_2018_10_30_000000_010000_xx.gz.

    Note

    Names of specific log files may not contain an extension field. Example: aliyundoc.com_2018_10_30_000000_010000.gz.

Log fields and descriptions

  • Sample log entry

    [9/Jun/2015:01:58:09 +0800] 10.10.10.10 - 1542 "-" "GET http://www.aliyun.com/index.html" 200 191 2830 MISS "Mozilla/5.0 (compatible; AhrefsBot/5.0; +http://example.com/robot/)" "text/html" 1.1.1.1 
  • Fields

    Field

    Description

    [9/Jun/2015:01:58:09 +0800]

    The end time of the request.

    10.10.10.10

    The first IP address in the X-Forwarded-For header that is carried in the request, which is client_ip. If the client does not use a proxy to connect to the point of presence (POP), the IP address is used by the client to connect to the POP.

    Note
    • The format of the X-Forwarded-For request header is X-Forwarded-For: <client_ip>, <proxy_ip>.

    • If the client does not use a proxy to connect to the POP, the X-Forwarded-For request header contains only <client_ip>. In this case, the value of client_ip in logs may be a private IP address. A common reason is that the Internet service provider (ISP) allocates a private IP address to the client to reduce the usage of public IP addresses and costs.

    • If the client uses a proxy to connect to the POP, the X-Forwarded-For request header contains <client_ip> and <proxy_ip>. In this case, the value of client_ip in logs may also be a private IP address. A common reason is that the ISP allocates a public IP address to the proxy and a private IP address to the client.

    -

    The second IP address in the X-Forwarded-For header that is carried in the request, which is proxy_ip. If the client does not use a proxy to connect to the Alibaba Cloud CDN POP, the value of this field is -.

    1542

    The response time. Unit: milliseconds.

    "-"

    The Referer header in HTTP requests.

    GET

    The request method.

    http://www.aliyun.com/index.html

    The request URL.

    200

    The HTTP status code.

    191

    The size of the request. Unit: bytes.

    2830

    The size of the response. Unit: bytes.

    MISS

    The cache hit status. Valid values:

    • HIT: The request is a cache hit and does not need to be redirected to the origin server.

    • MISS: The request is a cache miss and must be redirected to L2 POPs or the origin server.

    Note

    Alibaba Cloud CDN collects log data from POPs, except L2 POPs. If the field value is MISS, origin information is not provided. In this case, the log data does not show whether a cache-miss request is redirected to the origin server.

    Mozilla/5.0 (compatible; AhrefsBot/5.0; +http://example.com/robot/)

    The User-Agent header.

    text/html

    The file type.

    Note

    Logs of domain names for which you enable the global resource plan do not contain this field.

    1.1.1.1

    The IP address that is used by the client to connect to the POP.

Procedure

  1. Log on to the Alibaba Cloud CDN console.

  2. In the left-side navigation pane, choose Logs > Offline Logs.

  3. On the Log Download tab, select a domain name and a date and click Search.

  4. Find the log file that you want to download and click Download in the Actions column.

Related API operations

DescribeCdnDomainLogs: queries the address from which you can download the log data of a domain name.