简体   繁体   English

如何使用 CloudFormation 为多个日志组创建 AWS CloudWatch 订阅过滤器

[英]How to create AWS CloudWatch Subscription Filters for multiple Log Groups using CloudFormation

Good morning,早上好,

I have found those documents: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-subscriptionfilter.html https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/SubscriptionFilters.html#LambdaFunctionExample I have found those documents: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-subscriptionfilter.html https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs /SubscriptionFilters.html#LambdaFunctionExample

I want to use CloudFormation to create Subscription, that will handle multiple Log Groups at once.我想使用 CloudFormation 创建订阅,它将一次处理多个日志组。 Also, I want to create separate Subscription, that will handle all Log Groups.另外,我想创建单独的订阅,它将处理所有日志组。

Can I do it by single entry in CloudFormation yaml?我可以通过 CloudFormation yaml 中的单个条目来完成吗?

I see what you mean now, and you are right AWS::Logs::SubscriptionFilter does not support creating multiple subscription at once.我现在明白你的意思了,你是对的AWS::Logs::SubscriptionFilter不支持一次创建多个订阅。

If you really want to automate this and keep it within CloudFormation (CFN), you would have to develop CFN macro or custom resource .如果您真的想自动执行此操作并将其保留在 CloudFormation (CFN) 中,则必须开发 CFN 自定义资源 In both cases you would have to write your own lambda function which could create your subscriptions iteratively in a loop, based on the input parameters, eg a list of log groups.在这两种情况下,您都必须编写自己的 lambda function ,这可以根据输入参数(例如日志组列表)在循环中迭代地创建您的订阅 The lambda would have to use AWS SDK for that with proper execution role. lambda 必须使用 AWS SDK 才能获得适当的执行角色。

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

相关问题 如何删除 AWS CloudWatch 日志组中的订阅 - How to remove subscription in AWS CloudWatch Log Groups AWS Cloudwatch Insights 如何使用多个日志组进行查询 - AWS Cloudwatch Insights how to query using multiple log groups AWS Cloudwatch Insights:使用多个日志组进行查询 - AWS Cloudwatch Insights: query using multiple log groups 如何在 cloudFormation 模板中包含 cloudWatch Log Group 订阅? - How to include cloudWatch Log Group subscription in cloudFormation template? 如何在Elasticbeanstalk中通过AWS Cloudformation模板创建自定义日志并将其流式传输到Cloudwatch? - How to create a custom log and stream it to cloudwatch through AWS Cloudformation template in elasticbeanstalk ? 如何使用 cloudformation 模板创建 cloudwatch 事件? - How to create cloudwatch event using cloudformation template? 如何输入多个日志组以形成云 - How to input multiple log groups for cloudformation 如何为特定 CloudFormation 堆栈创建“aws.cloudformation”CloudWatch 事件类型? - How can I create an "aws.cloudformation" CloudWatch event type for a specific CloudFormation stack? 如何使用 cloudformation 模板为步进功能创建 cloudwatch 仪表板 - How to create cloudwatch dash board for step function using cloudformation templates 如何让 lambda 监听 cloudwatch 的多个日志组? - How to make a lambda listen on multiple log groups of cloudwatch?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM