Access Logging
Scenarios
Access logs record HTTP and HTTPS requests to your load balancer, including the request time, client IP address, request path, and server response. To enable access logging, you need to interconnect ELB with LTS and create a log group and log stream on the LTS console.
Only HTTP and HTTPS shared load balancers support access logging.
Currently, access logging is supported in following regions: CN North-Beijing4, CN East-Shanghai2, CN South-Guangzhou, CN North-Beijing1, AP-Bangkok, and CN East-Shanghai1.
Configuring LTS
To view load balancer access logs, you need to first configure LTS. For details about how to configure and operate LTS, see the Log Tank Service User Guide.
- Create a log group.
- Log in to the management console.
- In the upper left corner of the page, click
and select the desired region and project. - Click Service List. Under Management & Deployment, click Log Tank Service.

- In the navigation pane on the left, choose Log Management.
- Click Create Log Group. In the displayed dialog box, enter a name for the log group.
- Click OK.
- Create a log stream.
- Locate the newly created log group and click its name.
- Click Create Log Stream. In the displayed dialog box, enter a name for the log stream.
- Click OK.
Configuring Access Logging
- Click Service List. Under Network, click Elastic Load Balance.
- Locate the load balancer and click its name.
- Under Access Logs, click Configure Access Log.


- Enable access logging and select the created log group and log stream.
- Click OK.
Viewing Access Logs
After you enable access logging, you can obtain details about requests sent to your load balancer.
There are two ways for you to view access logs.
- On the ELB console, click the name of the load balancer and click Access Logs to view logs.
- (Recommended) On the LTS console, click the name of the corresponding log stream. On the displayed page, click Real-Time Logs
The following is an example log. For details about the fields in the log, see Table 1.
$msec $access_log_topic_id [$time_iso8601] $log_ver $remote_addr:$remote_port $status "$request_method $scheme://$host$router_request_uri $server_protocol" $request_length $bytes_sent $body_bytes_sent $request_time "$upstream_status" "$upstream_connect_time" "$upstream_header_time" "$upstream_response_time" "$upstream_addr" "$http_user_agent" "$http_referer" "$http_x_forwarded_for" $lb_name $listener_name $listener_id $pool_name "$member_name" $tenant_id $eip_address:$eip_port "$upstream_addr_priv" $certificate_id $ssl_protocol $ssl_cipher $sni_domain_name $tcpinfo_rtt
| Parameter | Description | Description | Example Value |
|---|---|---|---|
| msec | Time in seconds with a milliseconds resolution | Floating-point data | 1530153091.868 |
| access_log_topic_id | Log stream ID | UUID | 04465dfa-640f-4567-8b58-45c9f8bbc23f |
| time_iso8601 | Local time in the ISO 8601 standard format | - | 2018-06-28T10:31:31+08:00 |
| log_ver | Log format version | Fixed value: elb_01 | elb_01 |
| remote_addr: remote_port | IP address and port number of the client | Records the IP address and port of the client. | 10.184.30.170:59605 |
| status | HTTP status code | Records the request status code. | 200 |
| request_method scheme://host request_uri server_protocol | Request method Protocol://Host name: Request URI Request protocol |
| POST https://setting1.hicloud.com/AccountServer/IUserInfoMng/stAuth?Version=26400&cVersion=HwID_SDK_2.6.4.300 |
| request_length | Length of the request received from the client, including the header and body | Integer data | 295 |
| bytes_sent | Number of bytes sent to the client | Integer data | 58470080 |
| body_bytes_sent | Number of bytes sent to the client (excluding the response header) | Integer data | 58469792 |
| request_time | Request processing time in seconds, that is, the duration from the time when the load balancer receives the first request packet from the client to the time when the load balancer sends the response packet | Floating-point data | 499.769 |
| upstream_status | Response status code returned by the backend server
| HTTP status code returned by the backend server to the load balancer | 200 or "-, 200", or "502, 502: 200", or "502:" |
| upstream_connect_time | Time taken to establish a connection with the backend server, in seconds, with a millisecond resolution
| Floating-point data | 0.008, "-, 0.008", "0.008, 0.005: 0.004", or "0.008:" |
| upstream_header_time | Time taken to receive the response header from the backend server, in seconds, with a millisecond resolution
| Floating-point data | 0.008, "-, 0.008", "0.008, 0.005: 0.004", or "0.008:" |
| upstream_response_time | Time taken to receive the response from the backend server, in seconds, with a millisecond resolution
| Floating-point data | 0.008, "-, 0.008", "0.008, 0.005: 0.004", or "0.008:" |
| upstream_addr | Internal IP address and port number of the backend server This field can be ignored. | IP address and port number | 100.64.1.246:80 (There may be multiple values separated by commas (,) or spaces, colons (:) and spaces, and each value is in the format of IP address:Port number or -. |
| http_user_agent | http_user_agent in the request header received by the load balancer, indicating the system model and browser information of the client | Records the browser-related information. | Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36 |
| http_referer | http_referer in the request header received by the load balancer, indicating the page link of the request | Request for a page link | http://10.154.197.90/ |
| http_x_forwarded_for | http_x_forwarded_for in the request header received by the load balancer, indicating the IP address of the proxy server that the request passes through | IP address | 10.154.197.90 |
| lb_name | Load balancer name in the format of loadbalancer_Load balancer ID | String | loadbalancer_789424af-3fd2-4292-8c62-2a2dd7005175 |
| listener_name | Listener name in the format of listener_Listener ID | String | listener_fde03b66-f960-440e-954a-0be8b2b75093 |
| listener_id | Listener ID (this field can be ignored). | String | - |
| pool_name | Backend server group name in the format of pool_backend server group ID | String | pool_066a5dc5-a3e4-4ea1-99f1-2a5716b681f6 |
| member_name | Backend server name in the format of member_server ID (this field is not supported yet). There may be multiple values separated by commas and spaces, and each value is a member ID (member_id) or -. | String | member_47b07465-075a-4d2f-8ce9-0b9f39bff160 (There may be multiple values separated by commas and spaces, and each value is a member ID (member_id) or -. |
| tenant_id | Tenant ID | String | 04dd36f921000fe20f95c00bba986340 |
| eip_address:eip_port | EIP of the load balancer and frontend port that were set when the listener was added | EIP of the load balancer and frontend port that were set when the listener was added | 4.17.12.248:443 |
| upstream_addr_priv | IP address and port number of the backend server There may be multiple values by commas and spaces, and each value is in the format of IP address:Port number or -. | IP address and port number | -, 192.168.1.2:8080 (There may be multiple values by commas and spaces, and each value is in the format of IP address:Port number or -.) |
| certificate_id | [HTTPS listener] Certificate ID used for establishing an SSL connection This field is not supported yet. | String | 17b03b19-b2cc-454e-921b-4d187cce31dc |
| ssl_protocol | [HTTPS listener] Protocol used for establishing an SSL connection For a non-HTTPS listener, a hyphen (-) is displayed as a null value for this field. | String | TLSv1.2 |
| ssl_cipher | [HTTPS listener] Cipher suite used for establishing an SSL connection For a non-HTTPS listener, a hyphen (-) is displayed as a null value for this field. | String | ECDHE-RSA-AES256-GCM-SHA384 |
| sni_domain_name | [HTTPS listener] SNI domain name provided by the client during SSL handshake For a non-HTTPS listener, a hyphen (-) is displayed as a null value for this field. | String | www.test.com |
| tcpinfo_rtt | TCP Round Trip Time (RTT) between the load balancer and client in microseconds | Integer data | 39032 |
Configuring Log Transfer
If you want to analyze access logs later, transfer the logs to OBS or Data Ingestion Service (DIS) for storage.
- Click Service List. Under Management & Deployment, click Log Tank Service.
- Click Log Transfer.

- Set the parameters based on site requirements. For details, see the Log Tank Service User Guide.
Last Article: IP Address Group
Next Article: Sensitive Operation Protection (Preventing Misdeletions)
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.