The Definitive Guide to AWS Log Analytics Using ELK: Part II
Here is Part II of this step-by-step guide to retrieving log data from all cloud layers and then visualizing and correlating these events to give a clear picture of one’s entire AWS infrastructure.
Join the DZone community and get the full member experience.Join For Free
in part i , we covered why you should be looking at your logs, why elk and logz.io, analyzing application and infrastructure logs, and monitoring your system performance with elk. this time, we will cover monitoring ebl logs, aws cloudtrail logs, aws vpc flow logs, cloudfront logs, and s3 access logs.
monitoring elb logs
what are elb log files?
elb is amazon web services’ ec2 load balancer. the elb logs are a collection of all of the traffic running through the elb. this data includes from where the elb was accessed, which internal machines were accessed, the identity of the requester (e.g., the operating system and browser) and additional metrics such as processing time and traffic volume.
how can i use elb log files?
there are many uses for elb logs, but the main reasons are to check the operational health of the elb and it’s efficient operation. in the context of operational health, you might want to determine if your traffic is being equally distributed amongst all internal servers. for operational efficiency, you might want to identify the volume of access that you are getting from different locations in the world. you can visit the elk labs and search for “elb” to find different visualizations, dashboards, and alerts.
how can i ship elb log files?
elb logs can be saved into a s3 bucket by making a very simple configuration in your ec2 console. once the files are in the s3 bucket, you can configure read-only access to that bucket here .
security – aws cloudtrail logs
what are cloudtrail log files?
cloudtrail logs is a logging mechanism of amazon web services’ ec2, which records all of the changes done in an environment. this is a very powerful and robust tool that gives a different set of events for each ec2 object that can be leveraged according to the desired use. ec2 log events include, among other things, access to the ec2 account and changes to security groups as well as activation and termination of machines and services.
how can i use cloudtrail log files?
cloudtrail logs are very powerful and have many uses. one of the main uses revolves around auditing and security. for example, we monitor access and receive internal alerts on suspicious activity in our environment. two important things to remember: keep track of any changes being done to security groups and vpc access levels, and monitor your machines and services to ensure that they are being used properly by the proper people. you can visit the elk labs and can search for “cloudtrail” to find different visualizations, dashboards, and alerts.
how can i ship cloudtrail log files?
cloudtrail logs are easy to configure because they ship to s3 buckets. as opposed to some ec2 services, cloudtrail logs can be collected from all different regions and availability zones into a single s3 bucket. once the files are in the s3 bucket, you can configure read-only access to that bucket here .
aws vpc flow logs
what are vpc flow logs?
vpc flow logs provide the ability to log all of the traffic that happens within an aws vpc (virtual private cloud). the information captured includes information about allowed and denied traffic (based on security group and network acl rules). it also includes source and destination ip addresses, ports, iana protocol numbers, packet and byte counts, time intervals during which flows were observed, and actions (accept or reject).
how can i use the vpc logs?
vpc flow logs can be turned on for a specific vpc, vpc subnet, or an elastic network interface (eni). most common uses are around the operability of the vpc. you can visualize rejection rates to identify configuration issues or system misuses, correlate flow increases in traffic to load in other parts of systems, and verify that only specific sets of servers are being accessed and belong to the vpc. you can also make sure the right ports are being accessed from the right servers and receive alerts whenever certain ports are being accessed. you can visit elk labs and search for “vpc” to find different visualizations, dashboards, and alerts.
how can i ship vpc logs?
once enabled, vpc flow logs are stored in cloudwatch logs, and you can extract them to a third-party log analytics service via several methods. the two most common methods are to direct them to a kinesis stream and dump them to s3 using a lambda function. at logz.io, we recommend using a third-party open source tool to dump cloudwatch logs to s3. you can read more about the different methods here .
what are cloudfront access logs?
cloudfront is aws’s cdn, and cloundfront logs include information in w3c extended format ( http://www.w3.org/tr/wd-logfile.html ) and report all access to all objects by the cdn.
how can i use cloudfront logs?
cloudfront logs are used mainly for analysis and verification of the operational efficiency of the cdn. you can see error rates through the cdn, from where is the cdn being accessed, and what percentage of traffic is being served by the cdn. these logs, though very verbose, can reveal a lot about the responsiveness of your website as customers navigate it. you can visit elk labs at https://app.logz.io/#/labs and search for “cloudfront” to find different visualizations, dashboards, and alerts.
how can i ship cloudfront logs?
once enabled, cloudfront will write data to your s3 bucket every hour or so. you can then pull the cloudfront logs to logz.io by pointing to the relevant s3 bucket. go here for additional assistance and to see examples on how to configure access.
s3 access logs
what are s3 access logs?
s3 access logs record events for every access of an s3 bucket. access data includes the identities of the entities accessing the bucket, the identities of buckets and their owners, and metrics on access time and turnaround time as well as the response codes that are returned.
how can i use s3 access logs?
monitoring s3 access logs is a key part of securing aws environments. you can determine from where and how buckets are being accessed and receive alerts on illegal access of your buckets. you can also leverage the information to receive performance metrics and analyses on such access to ensure that overall application response times are being properly monitored.
how can i ship s3 access logs?
once enabled, s3 access logs are written to a s3 bucket of your choice. you can then pull the s3 access logs to logz.io by pointing to the relevant s3 bucket. go here for additional assistance and to see examples of configuring access.
elk is a very powerful platform and can provide tremendous value when you invest the effort to generate a holistic view of your environment. when running on aws, the majority of infrastructure logs can be added with a single click of the button to logz.io’s elk cloud platform. in a manner of minutes, you’ll be able to leverage the auto-generated dashboards and alerts.
there are many uses for aws logs that range from performing audits to maintaining security — and all uses can be supported with s3 access and cloudtrail logs and then monitored with cloudfront and vpc flow logs. make sure to check out elk labs for the marketplace for auto-generated dashboards and alerts.
Published at DZone with permission of Samuel Scott, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.