简体   繁体   English

我们可以使用 CloudWatch 查看存储在 S3 中的日志吗?

[英]Can we view Logs stored in S3 using CloudWatch?

My application is storing logs in S3 in a specific format.我的应用程序以特定格式在 S3 中存储日志。 But currently, I'm not able to view those logs directly.但目前,我无法直接查看这些日志。 Can we use AWS CloudWatch to view those logs that are stored in S3?我们可以使用 AWS CloudWatch 查看存储在 S3 中的那些日志吗?

When I checked, I saw that we can use CloudWatch Logs to create Log group and then store logs to that using cloudwatch agent.当我检查时,我看到我们可以使用 CloudWatch Logs 创建日志组,然后使用 cloudwatch 代理将日志存储到该组中。 But is there a way to import logs from S3 to CloudWatch and view them on the cloudwatch logs section?但是有没有办法将日志从 S3 导入 CloudWatch 并在 cloudwatch 日志部分查看它们?

Possible alternative:可能的选择:

Consider using AWS Athena to view and query your application logs that are stored in S3.考虑使用 AWS Athena 查看和查询存储在 S3 中的应用程序日志。

For example, here's a guide to using Athena to query CloudFront access logs that are stored in S3:例如,以下是使用 Athena 查询存储在 S3 中的 CloudFront 访问日志的指南:

https://docs.aws.amazon.com/athena/latest/ug/cloudfront-logs.html https://docs.aws.amazon.com/athena/latest/ug/cloudfront-logs.html

Yes you can but not directly,是的,你可以但不能直接,

Two options..两种选择..

  1. Lambda function trigger from s3:PutObject events then send to CW. Lambda function 从 s3:PutObject 事件触发,然后发送到 CW。 Probably costly and not as effective as 2 obviously depends on the logs amount or log pulling frequency.可能成本高且不如 2 有效,这显然取决于日志数量或日志提取频率。
  2. Use cwagent in your application and stream logs directly to a CW log group.在您的应用程序中使用 cwagent,stream 直接记录到 CW 日志组。

Option two is the best, good luck!方案二最好,祝你好运!

You can use Amazon Athena to query Application server logs stored in Amazon S3.您可以使用 Amazon Athena 查询存储在 Amazon S3 中的应用程序服务器日志。 See AWS documentation for Querying web server logs stored in Amazon S3 .请参阅 AWS 文档以查询存储在 Amazon S3 中的 web 服务器日志

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

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