gpt4 book ai didi

amazon-web-services - AWS Lambda CloudWatch 日志记录是否同步?

转载 作者:行者123 更新时间:2023-12-04 02:07:13 25 4
gpt4 key购买 nike

AWS Lambda CloudWatch 日志记录是同步的吗?

AWS 建议 AWS Lambda 应该登录到 CloudWatch,如果需要,它可以从那里流式传输到多个地方。

我想不出一个好的方法来测试这个,因此这个问题。

如果是同步的:

1) 延迟/KB 是多少?

如果是异步的:

1) 当 Lambda 函数完成其工作(返回对调用者的响应)时,AWS 文档说它可以随时销毁以缩小规模或出于任何原因简单地被另一个实例替换,如果它确实是异步的,那么如何AWS 保证日志不会丢失?

更新:我发现无论我们谈论什么语言,Lambda 最终都会写入控制台(node.js 中的 console.log,C# 中的 Console.Writeline),我想 AWS从控制台获取它并将其放入 Cloudwatch。这只会让我更加困惑,如果有人能指出数据流图,那就太棒了。

最佳答案

来自 AWS 论坛的答案,当我没有从这里收到答案时,我在该论坛上发帖:

At present, Lambda writes asynchronously to Cloudwatch logs for console.log type calls, and in the unlikely event, logs can be lost.

For example if there is a service event in Cloudwatch logs, logs may fail silently.

However, under normal operation, even after the lambda container has been destroyed or replaced, the lambda service would still have a chance to complete writing logs, thus it would be very unlikely logs would be lost.

If you need guarantees, then I would suggest create blocking code, using the respective SDK's to write directly to CloudWatch logs (i.e. not console.log ) to fail the lambda function when required.

If you are seeing this issue often please do open a ticket with the AWS support team and we will certainly investigate further.

AWS 论坛问题 @ https://forums.aws.amazon.com/thread.jspa?messageID=768836

关于amazon-web-services - AWS Lambda CloudWatch 日志记录是否同步?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42269798/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com