Lambda日志和CloudWatch PutLogEvents限制 [英] Lambda log and CloudWatch PutLogEvents limit
问题描述
我知道
- Lambda调用
PutLogEvents
在内部记录消息。 - CloudWatch对
PutLogEvents
有限制。
< blockquote>
PutLogEvents:每个日志流每秒5个请求。
我想知道
-
PutLogEvents
是否还会限制Lambda日志流? - 如果是这样,如何知道Lambda日志流是否受到限制?
日志流中是否有任何错误消息?
- Lambda何时调用
PutLogEvents
?
例如,
- 在Lambda函数的末尾,它会一次调用
PutLogEvents
- 当刷新缓冲区(stdout)时,它始终会调用
PutLogEvents
。
让我的回答分为两部分:
第1部分:在此处查看答案,了解您担心自己的lambda内部会受到抑制。除非您实际调用的是SDK方法,否则我同意此处的答案,并告诉您让Amazon处理其内部内容。我希望这能涵盖您问题的项目1和2。
现在为项目3:
AFAIK lambda运行时发送日志:
- lambda开始时。
- lambda结束时(或获取中断)
- 超时。
- 如果您明确使用运行时中提供的任何日志记录功能(根据我的一位同事:可以安全地假设发送到
stdout
的所有内容都会被记录)。 - 如果您在lambda中使用AWS开发工具包访问其他AWS服务。
I know
- Lambda calls
PutLogEvents
to log messages internally. - CloudWatch has a limit on
PutLogEvents
.
PutLogEvents: 5 requests per second per log stream.
I want to know
- Could Lambda log stream also be throttled by
PutLogEvents
? - If so, how to know if a Lambda log stream is throttled or not?
Any error message in the log stream?
- When does Lambda call
PutLogEvents
?
for example,
- at the end of a Lambda function, it calls
PutLogEvents
once. - when flushing buffer(stdout), it calls
PutLogEvents
all the time.
Let's brake my answer in 2 parts:
Part 1: Check answers here about your worries about being throttled from inside your lambda. Unless you're actually calling the SDK method I concur with the answers here and tell you that let Amazon handle their internal stuff. I hope this covers items 1 and 2 of your question.
Now for item 3:
AFAIK the lambda runtime sends logs:
- When your lambda starts.
- When your lambda ends (or get's interrupted by an exception).
- Timeout.
- If you explicitely use any of the logging functions provided in the runtime (according to a coworker of mine: it is safe to assume that everyting you send to
stdout
will be logged). - If you use AWS SDK inside your lambda to access other AWS services.
这篇关于Lambda日志和CloudWatch PutLogEvents限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!