amazon-web-services - 在 AWS Lambda 上记录错误和异常

标签 amazon-web-services aws-lambda

我有一些 AWS Lambda 函数,每天运行大约两万次。所以我想启用日志记录/警报来监视所有错误和异常。

cloudwatch 日志发出太多噪音,并且很难看到错误。 现在我打算将日志写入AWS S3 Bucket,这会对性能产生影响。

您建议记录和警告错误的最佳方式是什么?

最佳答案

另一种方法是保持一切不变(从应用程序的角度来看)并检查 AmazonCloudWatch Logs Filter .

You use metric filters to search for and match terms, phrases, or values in your log events. When a metric filter finds one of the terms, phrases, or values in your log events, you can increment the value of a CloudWatch metric.

如果您定义了过滤器,您可以针对该指标创建一个 CloudWatch Alarm,并在达到您定义的阈值时立即收到通知:-)

编辑

我没有检查 @Renato Gama 的链接。对不起。只需按照链接后面的说明操作,您的问题就可以轻松解决...

关于amazon-web-services - 在 AWS Lambda 上记录错误和异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49654276/

相关文章:

amazon-web-services - 对于 AWS Lambda, "batch size"究竟意味着什么?

performance - 使用内存不足的 Lambda 向 SQS 缓慢发送消息

node.js - 如何知道我的 lambda 绑定(bind)到的自定义域?

javascript - 将 AWS 配置传递给导入的模块

amazon-web-services - 如何获取 Amazon MSK 的代理终端节点作为输出

python - 如何使用 python 调用带有参数的第二个 lambda 函数

amazon-web-services - 在没有负载均衡器的情况下将 DNS (Route 53) 路由到 Elastic Beanstalk 应用程序

ios - iOS App中如何实现Amazon Kinesis Streaming实时处理数据

amazon-web-services - AWS WAF : How to make custom response code with managed rules for block actions

PowerShell - 如何将自定义模块打包到 AWS Lambda 的 zip 包中