为 AWS lambda 指定日志组? [英] Specify log group for an AWS lambda?

查看:51
本文介绍了为 AWS lambda 指定日志组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法指定 AWS lambda 记录到的 CloudWatch 日志组?它似乎是直接从 lambda 名称生成的;但是,例如将多个 lambda 聚合到单个日志组会特别方便.当 lambda 由 CloudFormation 模板创建时,我们对指定日志组特别感兴趣.

Is there a way to specify the CloudWatch log group that an AWS lambda logs to? It seems to be generated directly from the lambda name; however, it would be especially convenient to, for example, aggregate multiple lambdas to a single log group. We are especially interested in specifying the log group when the lambda is created by a CloudFormation template.

推荐答案

我认为这不可能.

即使可能,每个 AWS Lambda 实例仍会写入自己的日志流.尽管对同一个 lambda 的不同调用 可以写入相同的日志流(当 lambda 实例被重用时),但对于不同的 lambda,这绝对不是这种情况(因为它们必须使用不同的 lambda 实例).

Even if it were possible, each AWS Lambda instance would still write to its own log-stream. And though different invocations of the same lambda can write to the same log-stream (when the lambda instance is reused), this will definitely not be the case for different lambdas (since they must use different lambda instances).

因此,您必须有一个工具来聚合多个日志流.如果是这样,让它更通用一点有什么问题,以便它可以聚合来自不同日志组的日志流?

As a result, you must have a tool that aggregates multiple log-stream. If so, what's the problem with making it a little more generic, so that it can aggregate log-streams from different log groups?

这篇关于为 AWS lambda 指定日志组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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