This is great but requires some corrections:
For example, SELECT * from alb_log where elb_status_code = '503'; will fail with "TYPE_MISMATCH: line 1:46: Cannot apply operator: integer = varchar(3)" error:
and we should use the following instead: SELECT * from alb_log where elb_status_code = 503;
Also this query:
SELECT COUNT(request_verb) AS count, request_verb, client_ip FROM alb_log_partition_projection WHERE day = '2022/05/21' GROUP BY request_verb, client_ip;
Needs to be changed to:
SELECT COUNT(request_verb) AS count, request_verb, client_ip FROM alb_log WHERE day = '2022/05/21' GROUP BY request_verb, client_ip;
Not a major issue its just the table name according to your tutorial.
Thank you for your comment. We'll review and update the Knowledge Center article as needed.
Create table queries missing REGION from the S3 path
Thank you for your comment. We'll review and update the Knowledge Center article as needed.
The region is still missing from the S3 paths in the first CREATE TABLE query. Without this, the table doesn't work and returns no results.
Thank you for your comment. We'll review and update the Knowledge Center article as needed.
The first create table in step 3 has an extra single quote in the LOCATION line:
LOCATION ''s3://<your-al...
This example in the article:
SELECT target_ip, (Count(target_ip)* 100.0 / (Select Count(*) From alb_logs)) as backend_traffic_percentage FROM alb_logs GROUP by target_ip< ORDER By count() DESC;
Give this error when running:
error - line 5:1: mismatched input '<'. Expecting: <predicate>
I was able to resolve it by removing < after target_ip on line 4.
SELECT target_ip, (Count(target_ip)* 100.0 / (Select Count(*) From alb_logs)) as backend_traffic_percentage FROM alb_logs GROUP by target_ip ORDER By count() DESC;
Thank you for your comment. We'll review and update the Knowledge Center article as needed.
Is there something that needs to be done to load the log files into athena? I followed this article step by step. I have the table created but I do not see the logs. I have logs in S3. What is the secret?
Thank you for your comment. We'll review and update the Knowledge Center article as needed.
This article helped me to solve the issue here: https://docs.aws.amazon.com/athena/latest/ug/application-load-balancer-logs.html
Relevant content
- asked 5 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 3 months ago