I'm going to profess that I have not actually started deploying AWS Lambda functions yet, but this article says this:
The logs on AWS CloudWatch are horrible. It took me an eternity to find failing functions for simple applications, imagine the horror with large scale applications.
Is there something particularly hard about filtering the log on AWS Cloudwatch? For example if we deploy the stock hello lambda from Servless's node template I imagine that it's fairly easy to find the invocations (Error or otherwise) in the log?
If anyone has any simple best practice tips that we can follow to make the log statements easy to find that would be awesome!
IMO – CloudWatch Logs are perfectly fine for most Serverless applications. You can access them via serverless logs
on the client, or via the AWS Console.
The main thing you can do to make your life easier is to log at various levels (via console.log
, console.info
, console.warn
and console.error
) to allow you to separate different kinds of error messages out further down the line, and to attach some metadata to each log line – e.g. the ID of the thing you're operating on.
Winston is a library that can make this process easier for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With