简体   繁体   English

是否有可接受的方式从单个 AWS Lambda Function 记录到多个日志组?

[英]Is there an acceptable way to log to multiple log groups from a single AWS Lambda Function?

We use lambda for the backend of our mobile application and we recently started using Cloudwatch Log Insights.我们使用 lambda 作为我们移动应用程序的后端,我们最近开始使用 Cloudwatch Log Insights。 It would be great to be able to make individual streams such as Info, Error, and Transactions that would allow us to more cost effectively query certain data instead of having to pay to parse all the data for every query.如果能够制作单独的流(例如 Info、Error 和 Transactions),这将使我们能够更经济高效地查询某些数据,而不必为每次查询解析所有数据而付费。 Is there a built in or otherwise acceptable way to do manage what stream a message goes to?是否有内置或其他可接受的方式来管理 stream 消息发送到的内容?

I know you want to create multiple log groups, but this does not seem possible by default.我知道您想创建多个日志组,但默认情况下这似乎是不可能的。

However, considering your use case, it is always possible to custom build your solution.但是,考虑到您的用例,始终可以自定义构建您的解决方案。 For example, configure multiple CloudWatch Logs Groups and use the API to manually publish log entries.例如,配置多个 CloudWatch Logs 组并使用 API 手动发布日志条目。

https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html . https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html

Alternatively, you can also configure a downstream process that subscribes to the main log group, and performs the splitting.或者,您也可以配置订阅主日志组并执行拆分的下游进程。

You can also take a look at Lambda Extensions, especially if you want to forward the logs to one of the supported partners.您还可以查看 Lambda 扩展,特别是如果您想将日志转发给受支持的合作伙伴之一。

https://aws.amazon.com/blogs/compute/using-aws-lambda-extensions-to-send-logs-to-custom-destinations/ https://aws.amazon.com/blogs/compute/using-aws-lambda-extensions-to-send-logs-to-custom-destinations/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM