简体   繁体   English

AWS Cloudformation 如何将日志从 CloudWatch Logs 发送到 S3

[英]AWS Cloudformation How to send logs from CloudWatch Logs to S3

I want to send EC2 logs from CloudWatch Logs to S3 using Cloudformation.我想使用 Cloudformation 将 EC2 日志从 CloudWatch Logs 发送到 S3。 And I got a below message Error parsing ARN from given role or target (Service: AWSLogs; Status Code: 400; Error Code: InvalidParameterException; Request ID: 357e76a9-5ade-48a6-8206-84092390602f; Proxy: null)我收到以下消息 Error parsing ARN from given role or target (Service: AWSLogs; Status Code: 400; Error Code: InvalidParameterException; Request ID: 357e76a9-5ade-48a6-8206-84092390602f; Proxy: null)

I don't understand which part is wrong in my code below.我不明白我下面的代码中哪一部分是错误的。 Could you help me?你可以帮帮我吗?

S3: S3:

Type: 'AWS::S3::Bucket'
    Properties:
      BucketName: vocsample01
      AccessControl: Private

CloudWatch Logs: CloudWatch 日志:

Type: 'AWS::Logs::Destination'
Properties:
 DestinationName: vocsample01
 DestinationPolicy: >
  {"Version": "2012-10-17","Statement": [
    {"Effect": "Allow","Action": "logs:*","Resource": "*"}]}
 RoleArn: arn:aws:iam::009150350157:role/vocsample
 TargetArn: arn:aws:s3:::vocsample0

S3 can't be Log destination . S3不能是 Log destination Valid destinations are :有效目的地

  • Kinesis stream Kinesis stream
  • Firehose消防水带
  • Lambda Function Lambda Function

If you want to load your logs to S3, you have to setup firehose first:如果要将日志加载到 S3,则必须先设置 firehose:

CW Logs ---> Firehose ---> S3

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

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