首页 > 解决方案 > 是否可以将日志从 EC2 实例自动导出到 S3 存储桶?

问题描述

我希望日志在生成后立即保存到 S3 存储桶中。

从我读过的内容来看,似乎可以通过 Cloudwatch 从 EC2 导出到 S3,但在尝试后,导出似乎是用“开始”日期和“结束”日期修复的。

还有其他方法可以将我的日志保存在 S3 存储桶上吗?

标签: amazon-web-servicesamazon-s3amazon-ec2amazon-cloudwatchamazon-cloudwatchlogs

解决方案


You can create a role with permission to write to certain bucket, than assign this role to EC2 instance. Then you will be able to export logs from ec2 instance directly to S3 using s3 api. You can write a shell script exporting logs and run it as cron job.


推荐阅读