最終更新日:2026-08-28 17:39:53
When your requests pass through CDN Pro nodes, CDN Pro servers write access logs for the requests. You can download these logs for analysis. Before there are logs available for download, you must create a log configuration. Only after the log configuration is created will our data center process, aggregate, and store the access logs generated by the servers. This article describes how to create log configurations and download access logs in the CDN Pro portal.
In the CDN Pro portal, click the left-side menu Log and Reports > Log Download, then click the Configuration tab. On the log configurations page, you can create log configurations, as well as edit and delete them.
On the log configurations page, click Create Log Configuration and fill in the form.
Enter the following information:
Hostnames: Enter the hostnames for which you want to enable log collection. Separate multiple hostnames with spaces or line breaks. Supported values are: ① a single hostname, for example example.com; ② a wildcard hostname with an asterisk, for example *.example.com; ③ all hostnames, represented by a single asterisk (*).
Notes: ① When there are multiple log configurations matching the same hostname, the one with the highest specificity takes precedence. For example, if you create log configuration A with *.example.com and log configuration B with a.example.com, then logs for a.example.com will be generated, following log configuration B. ② The hostnames specified in the log configuration must already be added to a property in CDN Pro.
Description: A remark describing the purpose of the log configuration to help you manage and find configurations.
Days to Store Logs: The number of days to retain logs. Range: 1–30 days. Default: 14 days.
Time Span of Log Files: The time span of log entries in each log file. For example, 5 minutes means creating one log file every 5 minutes; 1440 minutes means creating one file per day. Supported timespans: 5, 15, 30, 60, 120, 240, 480, and 1440 minutes.
Log Format: The format of each log entry. Default format: "%cltip %rmtuser [%utctime] \"%method %url %protocol\" %statuscode %rspsize \"%referer\" \"%ua\" %rsptime". You can customize the format using the supported variables (see Supported Variables in this article). If a variable value contains non-printable characters (ASCII <= 0x1F or >= 0x7F), a double quote, or a backslash, those characters are escaped as \xXX. For example, a double quote is escaped as \x22 and a backslash as \x5C. Note: spaces are not escaped. If a variable may contain spaces, wrap that variable in double quotes.
You can use the following variables in log format:
Variable |
Description |
|---|---|
| %cachestate | Cache status: HIT, MISS, or REVALIDATED |
| %cltip | Client IP address |
| %cltisp | Client ISP |
| %cltport | Client port |
| %cltregion | Client region |
| %content_code | Content code (CP code) |
| %cpu_ns | CPU time spent by CDN Pro servers to process the request. Measured in nanoseconds |
| %custom_1 | Custom log field defined by the custom_log_field directive, ID 1 |
| %custom_2 | Custom log field defined by the custom_log_field directive, ID 2 |
| %hostname | Host header |
| %method | HTTP method (for example, GET) |
| %protocol | HTTP version used by the client (HTTP/1.0, HTTP/1.1, or HTTP/2.0) |
| %querystr | Query string |
| %referer | Referer header |
| %reqhdrsize | Size of the request headers in bytes |
| %reqrange | Range header in the request |
| %reqsize | Request size, including request line, headers and body, in bytes |
| %rmtuser | Username extracted from the Authorization header when using Basic Authentication |
| %rspsize | HTTP response size, including headers and body but excluding TCP/IP/MAC overhead. Measured in bytes |
| %rsptime | Response time in milliseconds |
| %samplerate | Log sampling rate |
| %scheme | Protocol used by the client (http or https) |
| %statuscode | HTTP response status code, for example 200 |
| %svrnode | Name of a CDN Pro node |
| %tcprtt | Round-trip time (RTT) between server and client, in microseconds |
| %ua | User-Agent header |
| %uniqueid | Unique identifier of the request |
| %url | Full request URL, including query string if present |
| %utctime | Response timestamp in RFC 3339 format, for example 2021-10-05T12:34:56Z |
On the log configurations page, find the log configuration you want to edit. In the Actions column, click Edit on the dropdown to modify the log configuration.
On the log configurations page, find the log configuration you want to delete. In the Actions column, click Delete on the dropdown to delete the log configuration.
In the CDN Pro portal, click the left-side menu Log and Reports > Log Download, then click the Log Download tab. On the log download page, you can query and download log files.
Hostname: Enter a hostname to find its log files. Note that only a single hostname input is supported and that wildcards are not supported. If you configured a wildcard hostname in the log configuration, you must search here by specific hostnames. For example, if your log configuration uses *.example.com and you have two hostnames a.example.com and b.example.com accelerated by CDN Pro, you need to enter a.example.com or b.example.com here to find the corresponding log files.
Time range: Specify the start and end time to find matching log files. Note that CDN Pro generates a log file only when there are requests to your hostname.
View list of log files: When there are matches found, a list of log files is displayed, showing the start time, end time and file size of each log file.
Download log files: Click Download in the Actions column to download a log file.