View AWS ALB access logs in one place

mcdrummerman

I have access logging configured for my AWS ALB. It dumps these logs into an S3 bucket on an interval.

To view them you have to download then unzip the file and look through the text.

I'd like to see a list of the ALB HTTP requests in one place without having to go through the process mentioned above.

Does AWS offer anything like this?

John Rotenstein

The AWS Application Load Balancer saves log files into Amazon S3.

Amazon Athena can then be used to query the files saved in S3. The important part is knowing the file format.

See this excellent article: Athena & ALB Log Analysis

They use this query to create the table:

CREATE EXTERNAL TABLE IF NOT EXISTS logs.web_alb (
  type string,
  time string,
  elb string,
  client_ip string,
  client_port string,
  target string,
  request_processing_time int,
  target_processing_time int,
  response_processing_time int,
  elb_status_code int,
  target_status_code string,
  received_bytes int,
  sent_bytes int,
  request_verb string,
  request_url string,
  request_proto string,
  user_agent string,
  ssl_cipher string,
  ssl_protocol string,
  target_group_arn string,
  trace_id string
)
PARTITIONED BY(year string, month string, day string) 
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.RegexSerDe'
WITH SERDEPROPERTIES (
  'serialization.format' = '1',
  'input.regex' = '([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*):([0-9]*) ([^ ]*) ([-0-9]*) ([-0-9]*) ([-0-9]*) ([-0-9]*) ([^ ]*) ([-0-9]*) ([-0-9]*) \"([^ ]*) ([^ ]*) ([^ ]*)\" \"([^\"]*)\" ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*)'
) LOCATION 's3://{{BUCKET}}/AWSLogs/{{ACCOUNT}}/elasticloadbalancing/us-east-1/';

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

AWS ALB - Access Logs versus Request Tracing versus CloudTrail Logs

Finding timing out request in AWS ALB access logs

MVVM architecture: one model - several view models + place for data access

Problem while querying partitions athena table for aws alb logs

Error on query parsing alb logs by datetime in aws athena

AWS S3 access through VPC endpoint and ALB

Can we use one ALB with AWS ECS Fargate?

using tail to view the access logs on my server

Can AWS ELB access logs be formatted?

React Native. Mechanism for turning on/off console logs in one place

How to aggregate logs from several Jenkins Jobs\Pipelines in one place?

AWS ALB : Rule priority

In AWS EKS, how can I define ingress to use one ALB for multiple subdomain URLs, each with their own certificate?

Access error logs on apache AWS EC2 Linux server

Where will I find access logs of EC2 Instance in AWS?

How to access checkboxes in a List view one by one

AWS ALB + Django + Gunicorn +- Nginx?

AWS ALB routes to other ALBs

AWS ALB Truncating HTTP response

AWS ALB Forward to Lambda with TLS

AWS ALB vs Docker swarm

AWS ALB Health Check 404

How the AWS ALB cost is calculated?

How can I view logs in an Heroku one-off dyno?

How can I view journalctl logs by unit and identifier with one command?

AWS - subscribe multiple lambda logs to one elasticsearch service

How to store access logs in one LOG STREAM instead of numerous?

AWS Lambda Logs using AWSCLI: How can I access Lambda logs using AWSCLI?

AWS Fargate Cluster unable to access Internet with NAT and Internet Gateways in place