AWS 的 Elastic Load Balancing 總算想起來這個欠了許久的功能,access log:「Access Logs for Elastic Load Balancers」。
原文裡有提到用 Hive 分析的部份,挑出最前面的欄位名稱就可以看出提供什麼資訊:
CREATE EXTERNAL TABLE elb_raw_access_logs ( Timestamp STRING, ELBName STRING, RequestIP STRING, RequestPort INT, BackendIP STRING, BackendPort INT, RequestProcessingTime DOUBLE, BackendProcessingTime DOUBLE, ClientResponseTime DOUBLE, ELBResponseCode STRING, BackendResponseCode STRING, ReceivedBytes BIGINT, SentBytes BIGINT, RequestVerb STRING, URL STRING, Protocol STRING )
裡面還有些資訊沒包含在上面,像是 availability zone。因為這個資訊是包含在檔名內:
In addition to the bucket name and the prefix that you specified when you configured and enabled access logs, the log file name will also include the IP address of the load balancer, your AWS account number, the load balancer's name and region, the date (year, month, and day), the timestamp of the end of the logging interval, and a random number (to handle multiple log files for the same time interval).
接下來應該要把現有的 ELB 都開起來 XD