Updated on 2024-03-22 GMT+08:00

Collecting Logs from ELB

LTS can collect logs from ELB.

Prerequisites

You have created and used a Huawei Cloud load balancer.

Restrictions

ELB access logs only record requests sent to layer 7 dedicated and shared load balancers. Layer 4 shared load balancing is not logged.

Procedure

Perform the following operations to configure ELB log ingestion:

  1. Log in to the LTS console.
  2. In the left navigation pane, choose Log Ingestion. On the displayed page, click ELB (Elastic Load Balance).
  3. Select a log stream.

    1. Select a log group from the Log Group drop-down list. If there are no desired log groups, click Create Log Group to create one.
    2. Select a log stream from the Log Stream drop-down list. If there are no desired log streams, click Create Log Stream to create one.
    3. Click Next: Configure ELB.

  4. Configure ELB.

    Click Configure ELB.
    1. On the network console, choose Elastic Load Balance.
    2. On the Elastic Load Balance page, click the name/ID of the target load balancer to go to the details page.
    3. Click the Access Logs tab and click Configure Access Logging.
    4. Enable log collection, and select a log group and stream.

      For details, see the Elastic Load Balance User Guide.

  5. Configure a log stream.

    Table 1 Log stream parameters

    Parameter

    Description

    Auto Structure and Index

    If this option is enabled, the log stream is automatically structured and indexed. The structuring is based on the ELB template, and the indexing enables quick analysis for all parsed ELB fields.

    Auto Add Tag log_type=elb_7layer_access

    If this option is enabled, the tag log_type=elb_7layer_access is automatically added to the log stream, and the ELB dashboard template can then match this log stream.

    Auto Create Dashboard

    If this option is enabled, an ELB dashboard is automatically created for the log stream.

  6. The operation is complete.

Structuring Template Details

  • ELB log example
    Table 2 Structuring template example

    Template Name

    Example Log

    ELB

    1594727856.337 e7c37d97-e922-457c-bbf3-dsadeqac [2020-07-14T19:57:36+08:00] elb_01 192.0.0.0:88888 200 "GET http://prod.sss.ads.sg2.aaa/loc/ation?version=3&ip=100.0.0.0&coordinate=27.7044784,85.3007481&device_id=dsadsadasdsadasd&beyla_id=wqeb123ndadsa233ddada HTTP/1.1" 233 293 138 0.001 "200" "0.000" "0.001" "0.001" "100.0.0.0:9999" "lua-resty-http/0.14 (Lua) ngx_lua/10000" "-" "-" loadbalancer_edsaee-4c9c-b467-5b8126b2f7f7dsa listener_6077809b-913f-466d-a96c-376f08882d5d 08cc2b3f68aa4dddd1e6a90dddd1688348a4480 pool_b2f2966c-043d-4674-ad4b-c15f2adb2c6b "-" 2fb78dsadadq1213das1121dab146ad3cb0 -:80 "101.0.0.0:10000" - - - - 9739
  • Structuring fields and description
    Table 3 Structuring fields

    Field

    Example

    Description

    Type

    msec

    1594727856.337

    Time when the log is written, in seconds with a milliseconds resolution

    float

    access_log_topic_id

    e7c37d97-e922-457c-bbf3-dsadeqac

    Log topic ID

    string

    time_iso8601

    2020-07-14T19:57:36+08:00

    Local time in the ISO 8601 standard format

    string

    log_ver

    elb_01

    ELB service log version

    string

    remote_addr

    192.0.0.0

    Client IP

    string

    remote_port

    88888

    Client port

    long

    status

    200

    Status code returned by ELB

    long

    request_method

    GET

    Request method

    string

    scheme

    http

    Request protocol

    string

    host

    prod.sss.ads.sg2.aaa

    Host name

    string

    router_request_uri

    location?version=3&ip=100.0.0.0&coordinate=27.7044784,85.3007481&device_id=dsadsadasdsadasd&beyla_id=wqeb123ndadsa233ddada

    Request URI.

    string

    server_protocol

    HTTP/1.1

    Request protocol.

    string

    request_length

    233

    Length of the request received from the client, including the header and body

    long

    bytes_sent

    293

    Number of bytes sent to the client

    long

    body_bytes_sent

    138

    Number of bytes sent to the client (excluding the response header)

    long

    request_time

    0.001

    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

    float

    upstream_status

    200

    Response status code returned by the upstream server. When the load balancer attempts to retry a request, there will be multiple response status codes. If the request is not correctly routed to the backend server, the value of this field is set to -.

    long

    upstream_connect_time

    0.000

    Time taken to establish a connection with the server, in seconds with a milliseconds resolution When the load balancer attempts to retry a request, there will be multiple connection times. If the request is not correctly routed to the backend server, the value of this field is set to - (null).

    float

    upstream_header_time

    0.001

    Time taken to receive the response header from the server, in seconds with a milliseconds resolution When the load balancer attempts to retry a request, there will be multiple response times. If the request is not correctly routed to the backend server, the value of this field is set to - (null).

    float

    upstream_response_time

    0.001

    Time taken to receive the response from the server, in seconds with a milliseconds resolution When the load balancer attempts to retry a request, there will be multiple response times. If the request is not correctly routed to the backend server, the value of this field is set to - (null)

    float

    upstream_addr

    100.0.0.0:9999

    IP address and port of the backend host There may be multiple values by commas and spaces, and each value is in the format of IP:Port or -.

    string

    http_user_agent

    lua-resty-http/0.14 (Lua) ngx_lua/10000

    http_user_agent in the request header received by the load balancer, indicating the system model and browser information of the client

    string

    http_referer

    -

    http_referer in the request header received by the load balancer, indicating the page URL of the request

    string

    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

    string

    lb_name

    loadbalancer_edsaee-4c9c-b467-5b8126b2f7f7dsa

    Load balancer name in the format of loadbalancer_Load balancer ID

    string

    listener_name

    listener_6077809b-913f-466d-a96c-376f08882d5d

    Listener name in the format of listener_Listener ID

    string

    listener_id

    08cc2b3f68aa4dddd1e6a90dddd1688348a4480

    Listener ID (This field can be ignored.)

    string

    pool_name

    pool_b2f2966c-043d-4674-ad4b-c15f2adb2c6b

    Backend server group name in the format of pool_Backend server group ID

    string

    member_name

    -

    Backend server name in the format of member_Server ID (not supported for now) There may be multiple values separated by commas and spaces, and each value is a member ID (member_id) or -

    string

    tenant_id

    2fb78dsadadq1213das1121dab146ad3cb0

    Tenant ID

    string

    eip_address

    -

    EIP

    string

    eip_port

    80

    Port listened on by the listener

    long

    upstream_addr_priv

    101.0.0.0:10000

    IP address and port number of the backend host. There may be multiple values by commas and spaces, and each value is in the format of IP:Port or -.

    string

    certificate_id

    -

    [HTTPS listener] Certificate ID used for establishing an SSL connection

    string

    ssl_protocol

    -

    [HTTPS listener] Protocol used for establishing an SSL connection. For a non-HTTPS listener, the value of this field is set to - (null).

    string

    ssl_cipher

    -

    [HTTPS listener] Cipher suite used for establishing an SSL connection. For a non-HTTPS listener, the value of this field is set to - (null).

    string

    sni_domain_name

    -

    [HTTPS listener] SNI domain name provided by the client during SSL handshake. For a non-HTTPS listener, the value of this field is set to - (null).

    string

    tcpinfo_rtt

    9739

    TCP Round Trip Time (RTT) between the load balancer and client in microseconds

    long