amazon-web-services - AWS : CloudWatch agent configuration file

标签 amazon-web-services amazon-cloudwatch

我正在尝试提供 CW 代理配置,关于后者应该跟踪哪些文件;
根据 this documentation , 此类信息应在 /etc/awslogs/awslogs.conf 中配置(以及 /etc/awslogs/awscli.conf 中的适当区域设置)。
然而,this page表示日志源(也可以?/应该?)在 /tmp/cwlogs/*.conf 中配置
第二个选项(在 /tmp 下)不会导致重新启动后 conf 文件丢失吗?
知道存储此类配置信息的正确位置是什么吗?

最佳答案

最好在使用用户数据创建新实例时安装和配置 CloudWatch 日志代理。这样,每当您启动新实例时,您都会获取最新的代理版本以及最新的配置文件。

将配置文件保存在 s3 中或作为 ssm 参数。

安装代理后,您可以通过传递“-a fetch-config”来启动它。

下面的链接详细介绍了如何启动 CloudWatch 代理。
链接 cloudwatch log agent查看“使用命令行在 Amazon EC2 实例上启动 CloudWatch 代理”

例如,如果 ami 是 linux(amazon 2) 并使用配置文件。下面应该做。

wget https://s3.amazonaws.com/amazoncloudwatch-agent/linux/amd64/latest/AmazonCloudWatchAgent.zip
unzip AmazonCloudWatchAgent.zip
./install.sh
/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:path-to-config-file.json -s

关于amazon-web-services - AWS : CloudWatch agent configuration file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53942268/

相关文章:

amazon-web-services - 由 elastic beanstalk 生成的 ec2 实例的默认用户名

node.js - aws-iot 设备和作业在同一进程中失去连接

scala - 错误 : value += is not a member of Long Scala

amazon-web-services - AWS EC2 Autoscaling 目标跟踪策略如何扩展?

amazon-web-services - 是否可以从 CloudWatch 为 Lambda 状态函数集创建计划规则

amazon-web-services - AWS::事件::规则失败调用调试信息?

amazon-web-services - 如何在 `If` 的 `Resources` 中使用 `serverless.yml` 条件?

amazon-web-services - 如何使用浏览器、Javascript 在 Amazon S3 上进行分段上传?

amazon-web-services - 检查SQS队列是否为空的有效方法

postgresql - 定期 RDS Postgresql 复制延迟