Even if a request never reaches the intended target, it is captured in an access log. This includes malformed requests and is especially helpful in the context of security since malformed requests can sometimes be attempts at things such as directory transversal attacks.
A sample of what is contained in the load balancer log files is shown here:
https 2018-07-02T22:23:00.186641Z app/packt-loadbalancer/50dc6c495c0c9188
192.168.131.39:2817 10.0.0.1:80 0.086 0.048 0.037 200 200 0 57
“GET https://www.example.com:443/
HTTP/1.1″ “curl/7.46.0” ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2
arn:aws:elasticloadbalancing:us-east-2:123456789012:targetgroup/sec-targets/73e2d6bc24d8a067
“Root=1-58337281-1d84f3d73c47ec4e58577259” “packt.example.com” “arn:aws:acm:us-east-2:123456789012:certificate/12345678-1234-1234-1234-123456789012”
1 2018-07-02T22:22:48.364000Z “authenticate,forward” “-” “-” “10.0.0.1:80” “200” “-” “-“
The following points discuss the first few fields of the log files and describe what they contain:
Note
You can find the complete list of all the fields and their descriptions on the Elastic Load Balancing Documentation pages: https://packt.link/f5Sfs
ELBs are one entry point to your applications and workloads. Web Application Firewalls (WAFs) can be a primary entry point that filters requests before they hit the ELB, especially Application Load Balancers. You are now ready to explore the types of logs that they produce.
When requests come to your WAF, they are logged via the CloudWatch service. Using CloudWatch gives you real-time metrics on how many requests hit your AWS WAF and how many match a particular rule. Metrics are published for every rule you set in the WAF. This includes both managed rules from AWS and custom rules that you write yourself. Even if you put your WAF on a blocked or count mode, the metrics still pass on to the CloudWatch service.
Using the CloudWatch service and its ingestion of the metrics produced by AWS WAF, you can set specific alarms for the different metrics, such as if the number of blocked requests is too high for a particular period. Along with tracking the metrics in the CloudWatch service, you can also get sampled web requests.
The following subsections will take you through the different types of logs that can be collected with the WAF service from AWS.