NLB 액세스 로그는 로드 밸러싱에 TLS 리스너가 있고,
TLS 요청에 대한 정보만 포함하는 경우에만 만들어집니다.
Elastic Load Balancing provides access logs that capture detailed information about the TLS requests sent to your Network Load Balancer. You can use these access logs to analyze traffic patterns and troubleshoot issues.
Access logs are created only if the load balancer has a TLS listener and they contain information only about TLS requests.
Access logging is an optional feature of Elastic Load Balancing that is disabled by default. After you enable access logging for your load balancer, Elastic Load Balancing captures the logs as compressed files and stores them in the Amazon S3 bucket that you specify. You can disable access logging at any time.
You can enable server-side encryption with Amazon S3-managed encryption keys (SSE-S3), or using Key Management Service with Customer Managed Keys (SSE-KMS CMK) for your S3 bucket. Each access log file is automatically encrypted before it is stored in your S3 bucket and decrypted when you access it. You do not need to take any action as there is no difference in the way you access encrypted or unencrypted log files. Each log file is encrypted with a unique key, which is itself encrypted with a master key that is regularly rotated. For more information, see Specifying Amazon S3 encryption (SSE-S3) and Specifying server-side encryption with AWS KMS (SSE-KMS) in the Amazon S3 User Guide.
There is no additional charge for access logs. You are charged storage costs for Amazon S3, but not charged for the bandwidth used by Elastic Load Balancing to send log files to Amazon S3. For more information about storage costs, see Amazon S3 Pricing.
Access log files
Elastic Load Balancing publishes a log file for each load balancer node every 5 minutes. Log delivery is eventually consistent. The load balancer can deliver multiple logs for the same period. This usually happens if the site has high traffic.
The file names of the access logs use the following format:
bucket[/prefix]/AWSLogs/aws-account-id/elasticloadbalancing/region/yyyy/mm/dd/aws-account-id_elasticloadbalancing_region_net.load-balancer-id_end-time_random-string.log.gz
The name of the S3 bucket.
prefixThe prefix (logical hierarchy) in the bucket. If you don't specify a prefix, the logs are placed at the root level of the bucket.
aws-account-idThe AWS account ID of the owner.
regionThe region for your load balancer and S3 bucket.
yyyy/mm/ddThe date that the log was delivered.
load-balancer-idThe resource ID of the load balancer. If the resource ID contains any forward slashes (/), they are replaced with periods (.).
end-timeThe date and time that the logging interval ended. For example, an end time of 20181220T2340Z contains entries for requests made between 23:35 and 23:40.
random-stringA system-generated random string.
You can store your log files in your bucket for as long as you want, but you can also define Amazon S3 lifecycle rules to archive or delete log files automatically. For more information, see Manage your storage lifecycle in the Amazon S3 User Guide.
Access log entries
The following table describes the fields of an access log entry, in order. All fields are delimited by spaces. When new fields are introduced, they are added to the end of the log entry. When processing the log files, you should ignore any fields at the end of the log entry that you were not expecting.
type | The type of listener. The supported value is .tls |
version | The version of the log entry. The current version is 2.0. |
time | The time recorded at the end of the TLS connection, in ISO 8601 format. |
elb | The resource ID of the load balancer. |
listener | The resource ID of the TLS listener for the connection. |
client:port | The IP address and port of the client. |
destination:port | The IP address and port of the destination. If the client connects directly to the load balancer, the destination is the listener. If the client connects using a VPC endpoint service, the destination is the VPC endpoint. |
connection_time | The total time for the connection to complete, from start to closure, in milliseconds. |
tls_handshake_time | The total time for the TLS handshake to complete after the TCP connection is established, including client-side delays, in milliseconds. This time is included in the connection_time field. |
received_bytes | The count of bytes received by the load balancer from the client, after decryption. |
sent_bytes | The count of bytes sent by the load balancer to the client, before encryption. |
incoming_tls_alert | The integer value of TLS alerts received by the load balancer from the client, if present. Otherwise, this value is set to -. |
chosen_cert_arn | The ARN of the certificate served to the client. If no valid client hello message is sent, this value is set to -. |
chosen_cert_serial | Reserved for future use. This value is always set to -. |
tls_cipher | The cipher suite negotiated with the client, in OpenSSL format. If TLS negotiation does not complete, this value is set to -. |
tls_protocol_version | The TLS protocol negotiated with the client, in string format. The possible values are , , and . If TLS negotiation does not complete, this value is set to -.tlsv10tlsv11tlsv12 |
tls_named_group | Reserved for future use. This value is always set to -. |
domain_name | The value of the server_name extension in the client hello message. This value is URL-encoded. If no valid client hello message is sent or the extension is not present, this value is set to -. |
alpn_fe_protocol | The application protocol negotiated with the client, in string format. The possible values are , , and . If no ALPN policy is configured in the TLS listener, no matching protocol is found, or no valid protocol list is sent, this value is set to -.h2http/1.1http/1.0 |
alpn_be_protocol | The application protocol negotiated with the target, in string format. The possible values are , , and . If no ALPN policy is configured in the TLS listener, no matching protocol is found, or no valid protocol list is sent, this value is set to -.h2http/1.1http/1.0 |
alpn_client_preference_list | The value of the application_layer_protocol_negotiation extension in the client hello message. This value is URL-encoded. Each protocol is enclosed in double quotes and protocols are separated by a comma. If no ALPN policy is configured in the TLS listener, no valid client hello message is sent, or the extension is not present, this value is set to -. The string is truncated if it is longer than 256 bytes. |
Example log entries
The following are example log entries. Note that the text appears on multiple lines only to make it easier to read.
The following is an example for a TLS listener without an ALPN policy.
tls 2.0 2018-12-20T02:59:40 net/my-network-loadbalancer/c6e77e28c25b2234 g3d4b5e8bb8464cd
72.21.218.154:51341 172.100.100.185:443 5 2 98 246 -
arn:aws:acm:us-east-2:671290407336:certificate/2a108f19-aded-46b0-8493-c63eb1ef4a99 -
ECDHE-RSA-AES128-SHA tlsv12 -
my-network-loadbalancer-c6e77e28c25b2234.elb.us-east-2.amazonaws.com
- - -
The following is an example for a TLS listener with an ALPN policy.
tls 2.0 2020-04-01T08:51:42 net/my-network-loadbalancer/c6e77e28c25b2234 g3d4b5e8bb8464cd
72.21.218.154:51341 172.100.100.185:443 5 2 98 246 -
arn:aws:acm:us-east-2:671290407336:certificate/2a108f19-aded-46b0-8493-c63eb1ef4a99 -
ECDHE-RSA-AES128-SHA tlsv12 -
my-network-loadbalancer-c6e77e28c25b2234.elb.us-east-2.amazonaws.com
h2 h2 "h2","http/1.1"
Bucket requirements
When you enable access logging, you must specify an S3 bucket for the access logs. The bucket can be owned by a different account than the account that owns the load balancer. The bucket must meet the following requirements.
Requirements
- The bucket must be located in the same region as the load balancer.
- The prefix that you specify must not include AWSLogs. We add the portion of the file name starting with AWSLogs after the bucket name and prefix that you specify.
- The bucket must have a bucket policy that grants permission to write the access logs to your bucket. Bucket policies are a collection of JSON statements written in the access policy language to define access permissions for your bucket. The following is an example policy.
-
Encryption
You can enable server-side encryption for your Amazon S3 access log bucket in one of the following ways:
- Using Amazon S3-Managed Encryption Keys (SSE-S3).
- Using Key Management Service (SSE-KMS) with customer managed keys .
Network Load Balancer access logs do not support KMS with AWS managed keys. For more information, see Specifying Amazon S3 encryption (SSE-S3) and Specifying server-side encryption with AWS KMS (SSE-KMS) in the Amazon S3 User Guide.
Enable access logging
When you enable access logging for your load balancer, you must specify the name of the S3 bucket where the load balancer will store the logs. For more information, see Bucket requirements.
To enable access logging using the console
- Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
- In the navigation pane, choose Load Balancers.
- Select your load balancer.
- On the Description tab, choose Edit attributes.
- On the Edit load balancer attributes page, do the following:
- For Access logs, choose Enable.
- For S3 location, type the name of your S3 bucket, including any prefix (for example, ). You can specify the name of an existing bucket or a name for a new bucket. If you specify an existing bucket, be sure that you own this bucket and that you configured the required bucket policy.my-loadbalancer-logs/my-app
- (Optional) If the bucket does not exist, choose Create this location for me. You must specify a name that is unique across all existing bucket names in Amazon S3 and follows the DNS naming conventions. For more information, see Bucket restrictions and limitations in the Amazon S3 User Guide.
- Choose Save.
To enable access logging using the AWS CLI
Use the modify-load-balancer-attributes command.
Disable access logging
You can disable access logging for your load balancer at any time. After you disable access logging, your access logs remain in your S3 bucket until you delete the them. For more information, see Working with buckets in the Amazon Simple Storage Service User Guide.
To disable access logging using the console
- Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
- In the navigation pane, choose Load Balancers.
- Select your load balancer.
- On the Description tab, choose Edit attributes.
- For Access logs, clear Enable.
- Choose Save.
To disable access logging using the AWS CLI
Use the modify-load-balancer-attributes command.
Processing access log files
The access log files are compressed. If you open the files using the Amazon S3 console, they are uncompressed and the information is displayed. If you download the files, you must uncompress them to view the information.
If there is a lot of demand on your website, your load balancer can generate log files with gigabytes of data. You might not be able to process such a large amount of data using line-by-line processing. Therefore, you might have to use analytical tools that provide parallel processing solutions. For example, you can use the following analytical tools to analyze and process access logs:
- Amazon Athena is an interactive query service that makes it easy to analyze data in Amazon S3 using standard SQL. For more information, see Querying Network Load Balancer logs in the Amazon Athena User Guide.
- Loggly
- Splunk
- Sumo Logic
Access logs for your Network Load Balancer - Elastic Load Balancing (amazon.com)
'[AWS] > ROG' 카테고리의 다른 글
[AWS] [활용] 외부 전용 인터넷 게이트웨이를 사용하여 서브넷에서 아웃바운드 트래픽만 사용 설정 (0) | 2022.04.05 |
---|---|
[AWS] Configure IPv6 for AWS EC2 Instance (0) | 2022.04.05 |
[AWS] [활용] IPv6 주소에서 작동하도록 로드 밸런서를 설정 (0) | 2022.04.04 |
[AWS] [활용] VPC에서 IPv6 구성 - AWS 네트워킹 (0) | 2022.04.04 |
[AWS] [활용] Route 53에 등록된 사용자 지정 도메인을 사용하여 정적 웹 사이트 구성 (0) | 2022.04.01 |
댓글