简体   繁体   English

为 kinesis firehose cloudformation 启用 cloudwatch 日志

[英]Enable cloudwatch logs for kinesis firehose cloudformation

I am trying to catch Cloudwatch logs for my firehose to find any errors when sending data to S3 destination.我正在尝试为我的 Firehose 捕获 Cloudwatch 日志,以在将数据发送到S3目的地时发现任何错误。 I created a cloudformation template with logging details我创建了一个带有日志详细信息的 cloudformation 模板

"CloudWatchLoggingOptions" : {
    "Enabled" : "true",
    "LogGroupName": "/aws/firehose/firehose-dev", -->firehose-dev is my firehosedeliverystream name 
    "LogStreamName" : "s3logs"
},

I have given necesary IAM permission to firehose for creating loggroupname and streamname .我已授予loggroupname必要的 IAM 权限以创建loggroupnamestreamname

{
    "Sid": "",
    "Effect": "Allow",
    "Action": [
        "logs:CreateLogGroup",
        "logs:CreateLogStream",
        "logs:PutLogEvents"
    ],
    "Resource": [
        "arn:aws:logs:*:*:*"
    ]
}

When i triggered the template i didnt find any of the loggroupname and streamname is created in cloudwatch logs.当我触发模板时,我没有在 cloudwatch 日志中找到任何日志组名和流名。

But when we give same IAM permissions to AWS::Lambda resource it will automatically create a loggroupname(ie /aws/lambda/mylambdaname ) and send the logs to the that group.但是,当我们向AWS::Lambda资源授予相同的 IAM 权限时,它会自动创建一个日志组名称(即/aws/lambda/mylambdaname )并将日志发送到该组。 But why this scenario is not working for firehose ?但是为什么这种情况不适用于 firehose ?

As a Workaround作为解决方法

I am manually creating AWS::Logs::LogGroup resource with name as /aws/firehose/firehose-dev and AWS::Logs::LogStream resource with name as s3logs .我手动创建AWS::Logs::LogGroup资源与名称/aws/firehose/firehose-devAWS::Logs::LogStream与名称作为资源s3logs


And also firehose will create a loggroup name and logstream name automatically, if we configure the firehose deliverystream using console.如果我们使用控制台配置 firehose 传输流,firehose 也会自动创建日志组名称和日志流名称。

Can't firehose create loggroup name and logstream name automatically like aws lambda do when configured through cloudformation?通过 cloudformation 配置时,firehose 不能像 aws lambda 一样自动创建日志组名称和日志流名称吗?

Thanks Any help is appreciated谢谢任何帮助表示赞赏

Its resource dependent.它的资源依赖。 Some resources will create the log group for you, some not.有些资源会为您创建日志组,有些则不会。 Sometimes console does create them in the background.有时控制台会在后台创建它们。 When you use CloudFormation, usually you have to do everything yourself.当您使用 CloudFormation 时,通常您必须自己做所有事情。

In case of Firehose you can create the AWS::Logs::LogGroup and AWS::Logs::LogStream resources in CloudFormation.对于 Firehose,您可以在 CloudFormation 中创建AWS::Logs::LogGroupAWS::Logs::LogStream AWS::Logs::LogGroup资源。 For example (yaml):例如(yaml):

MyFirehoseLogGroup:
  Type: AWS::Logs::LogGroup
  Properties: 
    RetentionInDays: 1
        
MyFirehoseLogStream:      
  Type: AWS::Logs::LogStream
  Properties: 
    LogGroupName: !Ref MyFirehoseLogGroup

Then when you define your AWS::KinesisFirehose::DeliveryStream , you could reference them:然后,当您定义AWS::KinesisFirehose::DeliveryStream ,您可以引用它们:

CloudWatchLoggingOptions: 
  Enabled: true
  LogGroupName: !Ref MyFirehoseLogGroup
  LogStreamName: !Ref MyFirehoseLogStream

暂无
暂无

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

相关问题 Amazon Kinesis Firehose作为cloudwatch记录消费者 - Amazon Kinesis Firehose as a cloudwatch logs consumer AWS Cloudwatch通过Kinesis Firehose登录到ElasticSeacrh - AWS Cloudwatch logs to ElasticSeacrh via Kinesis Firehose 将Kinesis Firehose设置为CloudFormation中CloudWatch Events规则的目标 - Setting Kinesis Firehose as target for CloudWatch Events Rule in CloudFormation Cloudwatch 日志 -> Kinesis Firehose -> S3 - 不是正确的 JSON? - Cloudwatch Logs -> Kinesis Firehose -> S3 - not proper JSON? Kinesis Firehose可以接收从CloudWatch Logs订阅中解压缩的内容吗? - Can Kinesis Firehose receive content uncompressed from CloudWatch Logs subscription? 用于连接 AWS Cloudwatch 日志、Kinesis Firehose、S3 和 ElasticSearch 的 AWS IAM 策略 - AWS IAM Policies to connect AWS Cloudwatch Logs, Kinesis Firehose, S3 and ElasticSearch 如何启用cloudwatch日志并在cloudformation中分配自定义域名 - How to enable cloudwatch logs and assign custom domain name in cloudformation 如何使用 Cloudformation 为 API 网关启用 Cloudwatch 日志? - How to enable Cloudwatch Logs for API Gateway using Cloudformation? Kinesis Firehose Delivery Stream 在使用 cloudformation 时无法承担角色 - Kinesis Firehose Delivery Stream is unable to assume role while using cloudformation 如何通过 cloudformation 模板向 Kinesis Firehose Delivery stream 添加标签? - How to add tag to a Kinesis Firehose Delivery stream through cloudformation template?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM