Lambda日志和CloudWatch PutLogEvents限制 [英] Lambda log and CloudWatch PutLogEvents limit

查看:156
本文介绍了Lambda日志和CloudWatch PutLogEvents限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道




  1. Lambda调用 PutLogEvents 在内部记录消息。

  2. CloudWatch对 PutLogEvents 有限制。



< blockquote>

PutLogEvents:每个日志流每秒5个请求。




我想知道




  1. PutLogEvents 是否还会限制Lambda日志流?

  2. 如果是这样,如何知道Lambda日志流是否受到限制?

日志流中是否有任何错误消息?


  1. Lambda何时调用 PutLogEvents

例如,




  • 在Lambda函数的末尾,它会一次调用 PutLogEvents

  • 当刷新缓冲区(stdout)时,它始终会调用 PutLogEvents


解决方案

让我的回答分为两部分:



第1部分:在此处查看答案,了解您担心自己的lambda内部会受到抑制。除非您实际调用的是SDK方法,否则我同意此处的答案,并告诉您让Amazon处理其内部内容。我希望这能涵盖您问题的项目1和2。



现在为项目3:



AFAIK lambda运行时发送日志:


  1. lambda开始时。

  2. lambda结束时(或获取中断)

  3. 超时。

  4. 如果您明确使用运行时中提供的任何日志记录功能(根据我的一位同事:可以安全地假设发送到 stdout 的所有内容都会被记录)。

  5. 如果您在lambda中使用AWS开发工具包访问其他AWS服务。


I know

  1. Lambda calls PutLogEvents to log messages internally.
  2. CloudWatch has a limit on PutLogEvents.

PutLogEvents: 5 requests per second per log stream.

I want to know

  1. Could Lambda log stream also be throttled by PutLogEvents?
  2. If so, how to know if a Lambda log stream is throttled or not?

Any error message in the log stream?

  1. 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:

  1. When your lambda starts.
  2. When your lambda ends (or get's interrupted by an exception).
  3. Timeout.
  4. 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).
  5. If you use AWS SDK inside your lambda to access other AWS services.

这篇关于Lambda日志和CloudWatch PutLogEvents限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆