AWS Log Aggregator on the Cheap

Viewed 512

Our CIO had a heart attack upon seeing our AWS bill.

I need to aggregate Apache and Tomcat logs from multiple EC2 (in scaling group) -- what could be the best way to initiate this without breaking the bank? The goal of the logs is to view events by IP address, account names, view the transaction flows (diagnostic/audit logging -- not so much as performance metrics).

ELK is out of the equation (political). Cloudwatch is allowed + anything else.

2 Answers

Depends on volume and access patterns, but pushing the logs to S3 and using Athena to query them is a good shout.

Its cheap because S3 is a really cheap datastore, and Athena is server-less, meaning you only pay for the queries you run.

Make sure you convert the logs to a compressed data format (like Apace Parquet) to save even more dosh.

https://aws.amazon.com/athena

https://docs.aws.amazon.com/athena/latest/ug/querying-apache-logs.html

https://aws.amazon.com/blogs/big-data/analyzing-data-in-s3-using-amazon-athena/

My arguments against S3/Athena would be that S3 may be the cheapest storage mechanism but how will you get the logs off your box and into S3? I'm not aware of any AWS agents that do this but there may be some commercial or open source projects to do it. Also, there is some setup required to get Athena to work for searching such as defining schemas and/or setting up AWS Glue Crawlers to discover data. You'll often find that Glue Crawlers won't be the great of identifying log data if it's not in something like JSON formatted.

I would highly recommend CloudWatch. AWS has created a CloudWatch agent that is available for multiple OSs that will pull and forward your logs from your EC2 instances. CloudWatch also has some free searching tools and now the more powerful CloudWatch Insights tool to help you search your data in a way similar to what other first-class log aggregators allow.

CloudWatch pricing is also pretty cheap. It's only $0.50/GB ingested and $0.02/GB long term storage (in us-east-1 at least). And there is no charge to use the CloudWatch agent which is the biggest advantage as you don't have to invent and test a new way to pull logs off of your boxes.

Related