Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cloudwatch logs on terminal

I am using AWS Lambda for my application. For logs, I have to see in UI only, which I really don't like to see. Is there a way that I could connect to Cloudwatch logs locally and then see the logs by the tail command? Or if I could access Cloudwatch server to see logs? Basically, I wanted to see logs on my terminal. If there is any way to do that, please let me know.

Thanks for your help.

like image 512
hatellla Avatar asked Feb 05 '23 06:02

hatellla


1 Answers

You can use AWS CLI to get your logs in real time. See: get-log-events

AWS doesn't provide a functionality where you can tail the log. There are few 3rd party tools you can use. I have used jorgebastida/awslogs which was sufficient for my needs.

Update 02/25/2021: Thanks to @adavea, I just checked and found AWS has added a new feature to tail the CW logs.

aws.logs.tail

--follow (boolean) Whether to continuously poll for new logs.

like image 156
helloV Avatar answered Feb 06 '23 21:02

helloV