[英]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.