Phillip Ninan
Phillip Ninan's Blog

Phillip Ninan's Blog

How to Tail Amazon CloudWatch Logs from Your Terminal

How to Tail Amazon CloudWatch Logs from Your Terminal

Phillip Ninan

Published on Aug 26, 2020

3 min read

Subscribe to my newsletter and never miss my upcoming articles

Control Center

This week I deployed a production full-stack application to AWS. This was the first web application that I deployed that relied solely on Amazon CloudWatch for logging. Amazon CloudWatch has been the control center for metrics on the health of my application. I monitor everything from ECS memory utilization to an Application Load Balancer unhealthy host count. My team is instantly notified when one of these metrics turns into an alarm. This service is invaluable when you are launching a new application that requires high availability. However, I quickly noticed something was missing...

Shortcoming

Nonetheless, I was very disappointed when our first live event kicked off and I went to Amazon CloudWatch to check out the logs to see what was going on. There is no tailing! Every time there was a new event in the logs I had to scroll down. For anyone who has ever had to monitor logs, this is an extreme inconvenience. When you are monitoring an application in real-time you need the ability to tail them. Tailing logs is in reference to watching them in near real-time as they occur.

Eureka

To sum up, I was able to find a solution to tail Amazon CloudWatch logs! There is a simple AWS CLI command you can use to tail your logs from your own command line. After reading StackOverflow and the AWS documentation documentation I found a solution. I was very happy with this solution as I have a warm heart for the terminal. I hope this helps someone else who is unable with the ability to tail logs on AWS!

aws logs tail --since 1d --follow #YOUR_LOG_GROUP

Did you find this article valuable?

Support Phillip Ninan by becoming a sponsor. Any amount is appreciated!

See recent sponsors Learn more about Hashnode Sponsors
 
Share this