Why does CDN access log statistics differ from CNZZ statistics?

  • CNZZ collects statistics by embedding a piece of JavaScript code in each Web page of a website. After a user visits a Web page, statistics can be collected only if the Web page is loaded successfully. If the Web page fails to be loaded or the Web page does not contain the JavaScript code, statistics cannot be collected. In addition, if a file or image on this website is referenced by another website, CNZZ cannot collect the corresponding statistics.
  • CDN collects statistics based on every access request in the logs. Therefore, the statistics are more comprehensive. In addition, when CDN calculates page views (PVs), multiple PVs are counted if the same page contains multiple iframe tags.

If the issue still persists, .

Why is there an entry with status code 408 in the CDN log?

This log entry is resulted from the CDN health check on the origin site. The CDN upper-layer node sends a TCP request (similar to Telnet) to the origin site. This health check does not affect the origin site.

If the issue still persists, .

What is the meaning of status code 304 in the CDN log?

When a client successfully sends a request to the server for the first time, the server returns the correct content to the client with status code 200. The response also includes the last modification time of the content and an entity tag (ETag) to examine whether the content has been modified. When the server receives the next request sent by the same client, the server checks whether the content has been modified since the last request based on the last modification time and ETag specified in the request. If no modification is made, the server returns status code 304 to the client, and the client directly loads the cached content. If the content has been modified, the server returns the client the latest content with the latest modification time and ETag.

Example:

As shown in the following figure, when the client requests an image for the first time, the server returns a response with status code 200. The response includes the Last-Modified and ETag fields.

When the client requests the image again, the last modification time and ETag are added to the request header. As shown in the following figure, the server checks whether the content has been modified based on the ETag and Last-Modified fields. If no modification is made, status code 304 is returned. If the content has been modified, the latest content is returned to the client with status code 200.

Therefore, it is normal that status code 304 is included in the server log information, CDN log information, or OSS log information. This indicates that the Web cache already contains the content and has not been modified since the last request. To update the local Web cache, press Ctrl + F5. As a result, the client clears the local Web cache and sends a request to the server. The server returns the requested content with status code 200.

If the issue still persists, .

How can I analyze CDN access logs?

In Linux, you can use the following commands to analyze CDN access logs:
  • Query all entries with status code 200 in a log file.

    grep -w "200" log_file |awk '{if($9=="206") print $0}' >200log.txt
  • Print a specific column in a log file.

    cat lolog_file |awk '{print $12}'
  • Calculate the response size of a log file.

    cat log_file |awk 'BEGIN {size=0} {size=size+$11} END{print "endsizeis",size/1024/1024,"M"} '
  • Query the top 10 IP addresses by visits.

    cat log_file | awk '{print $3}' |sort|uniq -c|sort -nr |head -10

For more information about CDN log fields, see EN-US_TP_5171.html#concept_khc_mbf_xdb.

If the issue still persists, .

How can I query the IP address of a CDN node?

You can use the diagnostic tool in the CDN console to check whether an IP address is the IP address of a CDN node. For more information, see EN-US_TP_5172.html#concept_grn_cdm_xdb.

If the issue still persists, .