ALB access logs

Updated at:
Copy as MD

Use ALB access logs with Simple Log Service to analyze user behavior, identify traffic patterns, and troubleshoot errors.

Billing

After ALB access logs are delivered to Simple Log Service, you are billed for storage, read traffic, requests, data transformation, and shipping. Simple Log Service billing.

Prerequisites

Simple Log Service is activated. Activate Simple Log Service.

Create an access log

  1. Log on to the ALB console.

  2. In the top navigation bar, select the region in which the ALB instance is deployed.

  3. In the left-side navigation pane, choose ALB > Instances. On the Instances page, click the ID of the instance that you want to manage.

  4. On the instance details page, click the Access Logs tab and click Create Access Log.

  5. In the Create Access Log dialog box, configure the Project and Logstore parameters, and click OK.

    Parameter

    Description

    Project

    Select a Simple Log Service project to manage resources. Options:

    • Select Project: Select an existing project from the drop-down list.

    • Create Project: Enter a project name in the field.

    Logstore

    Select a Logstore to collect, store, and query log data. Options:

    • Select Logstore: Select an existing Logstore from the drop-down list.

    • Create Logstore: Enter a Logstore name in the field. If you select Create Project, you must also select Create Logstore.

    Notes on Creating Service-linked Role

    A service-linked role is automatically created.

  6. In the message that appears, read the information and click OK.

    • If you create a Logstore, indexes and dashboards are enabled by default.

    • If you select an existing Logstore, dashboards are enabled automatically. Existing indexes are not overwritten. Create indexes in the Simple Log Service console.

View an access log

  1. On the Access Logs tab, click the link on the right side of Simple Log Service to go to the Simple Log Service console to view log data.

  2. On the Access Logs tab, click the Monitoring Center, Access Center, or Fine-grained Monitoring tab and specify filter conditions to query metrics.

    Module

    Description

    Monitoring Center

    Displays real-time monitoring data: PVs, Request Success Rate, Average Latency, 4xx Requests, Status Distribution, Traffic, P50/P90/P99/P9999 Latency, and top hosts/URLs/backends by requests, latency, and failure rate.

    Access center

    Displays access statistics: PV/UV day-on-day and week-on-week comparisons, PV/UV distribution, PVs Today, 7-day PVs, Top 10 States with Most Requests, Percentage of Mobile Users, top 10 hosts, top 10 user agents, and IP addresses with most requests.

    Fine-grained Monitoring

    Displays metrics aggregated at one-second intervals for identifying transient jitters: QPS, Access Latency, Upstream Latency, Success Rate, Request Traffic, Response Body Traffic, Status Code 2xx, Status Code 3xx, Error Codes, Upstream Status Code 2xx, Upstream Status Code 3xx, and Upstream Error Codes.

    • In the upper-right corner of the Monitoring Center, Access Center, or Fine-grained Monitoring tab, you can click More Charts to go to the CloudLens for ALB page to view more ALB reports. For more information, see View data reports.

    • In the upper-right corner of the Monitoring Center, Access Center, or Fine-grained Monitoring tab, you can click Configure Alert Rules to go to the CloudLens for ALB page to view alert incidents of ALB.

    • You can also use the following features in the upper-right corner of the Monitoring Center, Access Center, or Fine-grained Monitoring tab:

Record custom headers

slb_headers records custom request header names and values for request analysis.

The maximum custom header size per access log is 1 KB (expandable to 4 KB). To request an increase, contact your account manager. For more information, see Request length limits

  1. On the Access Logs tab, click Record Custom Headers in the Basic Information section.

  2. In the Record Custom HTTP Headers in Logs dialog box, select the listener that is added to the ALB instance from the drop-down list.

    To create a listener, click Create Listener in the drop-down list. For more information, see Add an HTTP listener, Add an HTTPS listener, and Add a QUIC listener.

  3. In the message that appears, read the information and click OK.

    After configuration, the slb_headers field records all request headers except:

    # The slb_headers field does not record information about the following headers:
    host
    referer
    user-agent
    x-forwarded-for
    x-readtime
    x-real-ip
    uber-trace-id
    X-B3-TraceId
    X-B3-SpanId
    X-B3-ParentSpanId
    X-B3-Sampled

Delete an access log

  1. On the Access Logs tab, click Disable Logging in the Basic Information section.

  2. In the message that appears, read the information and click OK.

Log fields

Field

Description

app_lb_id

The ALB instance ID.

__topic__

The log topic. Default: alb_layer7_access_log.

body_bytes_sent

The HTTP response body size. Unit: bytes.

client_ip

The client IP address if Retrieve Client IP is enabled; otherwise, the IP address of the previous hop.

host

The domain name or IP address. Resolution order: request parameters → host header → backend server IP.

http_host

The Host header of an HTTP request.

http_referer

The Referer header of an HTTP request.

http_user_agent

The User-Agent header of an HTTP request.

http_x_forwarded_for

The X-Forwarded-For header of an HTTP request.

http_x_real_ip

The X-Real-IP header of an HTTP request.

read_request_time

The amount of time that CLB takes to process the request. Unit: milliseconds.

request_length

The combined size of the request start line, headers, and body. Unit: bytes.

request_method

The request method.

request_time

Time from request receipt to response return. Unit: seconds.

request_uri

The URI of a request.

scheme

Request scheme: HTTP or HTTPS.

server_protocol

The HTTP protocol version. Examples: HTTP/1.0, HTTP/1.1.

slb_vport

The listener port of the ALB instance.

slb_xtrace

The trace ID of the ALB instance for tracing analysis.

xtrace_type

The data type used by Xtrace for tracing analysis for the ALB instance. Only Zipkin is supported.

ssl_cipher

The cipher suite used for SSL connection. Example: ECDHE-RSA-AES128-GCM-SHA256.

ssl_protocol

The SSL connection protocol. Example: TLS 1.2.

status

The HTTP status code returned by the ALB instance.

tcpinfo_rtt

TCP connection establishment time. Unit: milliseconds.

time

Log generation time in ISO 8601 format: yyyy-MM-ddTHH:mm:ssZ.

upstream_addr

The backend server IP address and port.

upstream_response_time

Time from backend connection establishment to closure. Unit: seconds.

upstream_status

The HTTP status code from the backend server.

vip_addr

The virtual IP address.

write_response_time

Write response time. Unit: milliseconds.

client_port

The client port number.

slb_headers

Custom headers. Available only after you enable custom header recording.

FAQ

Can I view data about requests accessing my ALB instance before I create an access log?

No, you cannot.

Access logs only capture data from the time you enable them. Before you create an access log, Simple Log Service does not collect any access data from ALB.