Storing Request Logs to COS

Last updated: 2020-03-04 14:32:42

PDF

Cloud Load Balancer supports configuring Layer-7 (HTTP/HTTPS) Access log (Access Log), Access log to help you understand client requests, assist troubleshooting, analyze and comb Access data, and so on. Currently, Access's log can be stored in COS for download and analysis. The supported regions include Guangzhou, Shanghai, Beijing, Hong Kong, Shanghai Finance and Shenzhen Finance.

  • The current log aggregation granularity is 1 hour, and there will be a certain delay in the transmission of log data.
  • Currently, Cloud Load Balancer only supports the storage and download of public network Layer-7 (HTTP/HTTPS) logs, but does not support the storage and download of Layer-4 (TCP/UDP) and private network Layer-7 logs.
  • Logging is currently free of charge. A free storage capacity of 50 GB is provided for individual users as specified in Free Quotas . If you have massive amounts of logs, please clean them up in a timely manner.
  • In regions that support storing Access logs to COS, if you do not enable Access logs, Tencent Cloud defaults to keeping the logs for 3 days; if you open Access logs, the storage time depends on COS storage. Storage of Access logs is not supported in other regions.

CLB's Access log is mainly used for troubleshooting to help businesses quickly locate problems. Access log functions include log reporting, log storage and query:

  • Log reporting, provide best-effort service (Best Effor Service), priority protection business repost, and then ensure log reporting.
  • Log storage and query, according to the storage service currently used to provide services to ensure SLA.

Open Access's log

  1. Log in to the Cloud Load Balancer Console .
  2. Click the Cloud Load Balancer ID, to be configured to enter the "Cloud Load Balancer basic Information" page.
  3. In the "log Access" module, edit the log and save it to COS.
  4. Select the corresponding bucket in the COS, under which to automatically create a folder named lb-id For the request logs. Then, click the bucket address to redirect to the log download page.

If you haven't created a COS bucket, see Creating a Bucket And select the corresponding storage location.

Log Format and Variable Descriptions

Log Format

[$stgw_request_id] [$time_local] [$protocol_type] [$server_addr:$server_port] [$server_name] [$remote_addr:$remote_port] [$status]  [$upstream_status] [$proxy_host] [$request] [$request_length] [$bytes_sent] [$http_host] [$http_user_agent] [$http_referer]
[$request_time] [$upstream_response_time] [$upstream_connect_time] [$upstream_header_time] [$tcpinfo_rtt] [$connection] [$connection_requests] [$ssl_handshake_time] [$ssl_cipher] [$ssl_protocol] [$ssl_session_reused]

Log Variable Descriptions

Variable Name Description
Time_local Access time and time zone, such as "01/Jul/2019:11:11:00 + 0800" where "+ 0800" represents UTC+8, i.e., Beijing time.
Protocol_type Protocol type (HTTP/HTTPS/SPDY/HTTP2/WS/WSS)
Server_addr:server_port Destination IP and port of a request.
Server_name Rule's server_name , i.e., server name.
Remote_addr:remote_port Client IP and client port.
Status The status code returned by CLB to the client.
Upstream_status Status code returned by RS to CLB.
Proxy_host Upstream ID.
CreatedTime: 2018-11-29 19:16:45 Request line.
Request_length Number of bytes of the request received by the client.
Bytes_sent Number of bytes of the request sent to the client.
Http_host Request domain name.
Http_user_agent The user_agent field of the HTTP protocol header.
Http_referer HTTP request source.
Request_time Request processing time (from the first byte received by the client until the last byte sent to it, i.e., the total time it takes for the client request to reach CLB, for CLB to forward the request to RS, for RS response data to arrive at CLB, and for CLB to forward the data to the client).
Upstream_response_time Time that an entire backend request takes (from when CONNECT RS starts until RS receives the response).
Upstream_connect_time Time it takes to establish a TCP connection to RS (from when CONNECT RS starts until CLB starts sending HTTP requests to RS)
Upstream_header_time Times it takes for RS to receive an HTTP header (from when CONNECT RS starts until RS receives the HTTP response header).
Tcpinfo_rtt TCP connection RTT.
Connection Connection ID.
Connection_requests Number of connection requests.
Ssl_handshake_time Time that an SSL handshake takes.
Ssl_cipher SSL cipher suite.
Ssl_protocol SSL protocol version.
Ssl_session_reused SSL SESSION reuse.a