如何从 AWS CloudWatch 中排除访问日志?

发布于 2025-01-15 00:30:45 字数 1134 浏览 1 评论 0原文

当我启用从 AWS Elastic Beanstalk 到 CloudWatch 的日志流式传输时,我不希望流式传输 nginx/access.log,只流式传输 log/web.stdout.log

这可能吗?

我在“身份和访问管理 (IAM)”中创建了一个策略:

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "logs:CreateLogStream",
"Resource": "arn:aws:logs:*:326272929619:log-group:/aws/elasticbeanstalk/Myweather-env/var/log/web.stdout.log:log-stream:*"
}
]
}

但是当我转到 Elastic Beanstalk 并启用“实例日志流式传输到 CloudWatch Logs”时,它会创建以下日志组:

/aws/elasticbeanstalk/Myweather-env/environment-health.log
/aws/elasticbeanstalk/Myweather-env/var/log/eb-engine.log
/aws/elasticbeanstalk/Myweather-env/var/log/eb-hooks.log
/aws/elasticbeanstalk/Myweather-env/var/log/nginx/access.log  <= can that be excluded?
/aws/elasticbeanstalk/Myweather-env/var/log/nginx/error.log  <= same
/aws/elasticbeanstalk/Myweather-env/var/log/web.stdout.log

我正在运行一个 Spring Boot 应用程序,该应用程序包含 ebextensions 中的配置:

option_settings:
- namespace: aws:elasticbeanstalk:cloudwatch:logs
  option_name: StreamLogs
  value: true

任何帮助将不胜感激。

When I enable log streaming from AWS Elastic Beanstalk to CloudWatch I don't want the nginx/access.log to be streamed, only log/web.stdout.log

Is that possible?

I have created a policy in "Identity and Access Management (IAM)" :

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "logs:CreateLogStream",
"Resource": "arn:aws:logs:*:326272929619:log-group:/aws/elasticbeanstalk/Myweather-env/var/log/web.stdout.log:log-stream:*"
}
]
}

But when I go to Elastic Beanstalk and enable "Instance log streaming to CloudWatch Logs", it creates the following log groups:

/aws/elasticbeanstalk/Myweather-env/environment-health.log
/aws/elasticbeanstalk/Myweather-env/var/log/eb-engine.log
/aws/elasticbeanstalk/Myweather-env/var/log/eb-hooks.log
/aws/elasticbeanstalk/Myweather-env/var/log/nginx/access.log  <= can that be excluded?
/aws/elasticbeanstalk/Myweather-env/var/log/nginx/error.log  <= same
/aws/elasticbeanstalk/Myweather-env/var/log/web.stdout.log

I'm running a Spring Boot application that contains a configuration in ebextensions:

option_settings:
- namespace: aws:elasticbeanstalk:cloudwatch:logs
  option_name: StreamLogs
  value: true

Any help will be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文