AWS Athena, launched in 2016, after I have written the original code is way better, more structured, and not all that expensive. Go use that instead of trying to mess with this legacy codebase!
Pale ALE, or Plain And LEan AWS Log-analyzer for ElasticLoadBalancer (that was really stretching it, wasn't it?) is a lean and simple utility written in bash which I use every now and then to see what's happening with my load balancer at about right now. As of now, it supports basic commands to get the most elementary info, and is not fit for processing warehoused data for insight over years.
It was needed. I could have used something like logtash, but it's not as lean in terms of installation, usage, maintenance, etc. Pale Ale is built in bash, which every programmer almost always has (and now even the Windows ones will have it). Plus it was fun, and hardly took 10 minutes. It is immensely useful to me on a daily basis.
You need to basically copy the tiny little functions and variables in your .bashrc
to be able to use them (and modify the variable as per your need). That's it for installation.
If you're looking for the traditional step-by-step guide, here it is:
- Clone
- Replace the parameters
BUCKET
,LOGPATH
mentioned at the top of the filebash_append.bash
to suit you. cat bashrc_append.bash >> ~/.bashrc
Appending the defined functionscd ~
. ./.bash_rc
If you have log file locally instead of on an S3 bucket, you can skip steps 1 and 2.
showlogs
lists all the log files that have been generated for today's calendar date as shown below.
- Choose the file you want to analyze by using
getlog [filename]
. This will download the file in your current directory
Alternatively, you can bulk download files for particular timestamps using the newly added command getlogs
getlogs 2018-08-19 00:10 2018-08-19 00:30
will get you log files between the two timestamps passed here (UTC).
- The fun begins! Use all sorts of commands (sigh, there are only three as of now) on this file to see "what's happening" (read that in Gary Cole voice from the movie Office Space) with your Elastic Load Balancer today!
find4xx [filename]
(literally type "4xx", not "404", not "400", but "4xx") lists 4xx status codes from the log file in question.find5xx [filename]
(again, literal "5xx") lists 5xx status codes from the log file provided.findslow [filename]
lists the requests which took the most amount of time from the log file.