Uploading CDN Logs to CLS

Last updated: 2020-08-04 10:43:23

    Overview

    After the domain name is added to Content Delivery Network (CDN), the CDN node will schedule and respond to all user resource requests. To help you statistically analyze resource access, CDN connects to the Cloud Log Service (CLS) platform, and supports uploading CDN access logs to CLS in real time for multi-dimensional analysis, including quality and performance monitoring, user access analysis using Top command, and download traffic statistics.

    Note:

    CDN Real-time Log Analysis is currently in beta. To use it, you can submit an application. You application will be reviewed within seven business days.

    Log Collection

    1. Log in to the CDN Console and click Log Service in the left sidebar to enter the log service page. Click the Real-time Log tab.
    2. Click Create to create a log topic.
    3. Enter the name of the new log topic and select the domain names to be bound to this topic:
      • The topic name must be unique.
      • A domain name can only be bound to one log topic.
      • The configuration will take effect in about 15 minutes.
    4. Log in to the CLS Console and click Search Analysis in the left sidebar to enter the search analysis page. Complete the following configurations:
      • Select the Shanghai region
      • Select “cdn_logset” for Logset
      • Select the log topic created in Step 3 for Log Topic
    5. Click Search Analysis to search CDN access logs in real time.

      Log data description

      The CDN logs uploaded to CLS contain the following fields:
      Log Field Raw Log Type CLS Type Description
      app_id Integer long APPID of your Tencent Cloud account
      client_ip String text Client IP
      file_size Integer long File size
      hit String text Cache HIT/MISS. A hit in a CDN edge server or parent node will be marked as HIT
      host String text Domain name
      http_code Integer long HTTP status code
      isp String text ISP
      method String text HTTP request method
      param String text URL parameters
      proto String text HTTP protocol identifier
      prov String text ISP districts
      referer String text Referer information, i.e., HTTP source address
      request_range String text Range parameter, i.e., request range
      request_time Integer long Response time (in milliseconds), which refers to the time it takes for a node to return all packets to the client after receiving a request
      rsp_size Integer long Number of bytes returned
      time Integer long Request time, which is a UNIX timestamp
      ua String text User-Agent information
      url String text Request path
      uuid String text Unique request identifier
      version Integer long Version protocol

    Log Analysis Samples

    Overall quality analysis

    Health log requests

    http_code<500 | select count(*)

    Average access latency

    select ROUND(avg(request_time),2)

    Error diagnosis

    Error code distribution

    select http_code,count(*) as c group by http_code order by c desc

    Querying and analyzing logs of an error code

    http_code:403

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help