热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

适用于Windows平台的ElasticBeanstalk环境中的CloudWatchLogs

我在这里阅读了类似的文章和问题,例如就像这个(

我在这里阅读了类似的文章和问题,例如就像这个(How can I enable CloudWatchLogs in an ElasticBeanstalk environment running Windows?)一样,但是并不能解决我的问题。
指标和日志位于CW中,但Beanstalk部署失败并出现以下错误:

2019-11-20 17:41:14 UTC+0300 ERROR During an aborted deployment,some instances may have deployed the new application version. To ensure all instances are running the same version,re-deploy the appropriate application version.
2019-11-20 17:41:14 UTC+0300 ERROR Failed to deploy application.
2019-11-20 17:41:14 UTC+0300 ERROR Unsuccessful command execution on instance id(s) 'i-***'. Aborting the operation.
2019-11-20 17:41:14 UTC+0300 INFO Command execution completed on all instances. Summary: [Successful: 0,Failed: 1].
2019-11-20 17:41:14 UTC+0300 ERROR [Instance: i-*** ConfigSet: Infra-WriteRuntimeConfig,Infra-EmbeddedPreBuild,Hook-PreAppDeploy,Infra-EmbeddedPostBuild,Hook-EnactAppDeploy,Hook-PostAppDeploy] Command failed on instance. Return code: 1 Output: null.
2019-11-20 17:41:12 UTC+0300 ERROR Error occurred during build: Command hooks failed

由于以下事实,AWS支持建议使用container_commands代替命令:


  

命令在服务之前执行,因此我建议将“命令”替换为“容器命令”

它没有帮助,同样的错误。

我的配置:

packages:
msi:
cloudwatch: https://s3.amazonaws.com/amazoncloudwatch-agent/windows/amd64/latest/amazon-cloudwatch-agent.msi
services:
windows:
AmazonCloudWatchAgent:
enabled: 'true'
ensureRunning: 'true'
files:
- "C:\\programdata\\Amazon\\AmazonCloudWatchAgent\\amazon-cloudwatch-agent.json"
files:
"C:\\programdata\\Amazon\\AmazonCloudWatchAgent\\amazon-cloudwatch-agent.json":
content: |
{
"agent": {
"metrics_collection_interval": 60,"logfile": "C:\\programdata\\Amazon\\AmazonCloudWatchAgent\\amazon-cloudwatch-agent.log"
},"metrics": {
"append_dimensions": {
"InstanceId": "${aws:InstanceId}","AutoScalingGroupName": "${aws:AutoScalingGroupName}"
},"metrics_collected": {
"statsd": {},"procstat": [
{
"exe": "process_name","measurement": [
"cpu_usage","cpu_time_system","cpu_time_user","memory_rss","memory_vms"
]
},{
"exe": "process_name2",{
"exe": "process_name3","memory_vms"
]
}
],"Memory": {
"measurement": [
"Available MBytes","Cache Faults/sec","Page Faults/sec","% Committed Bytes In Use","Pages/sec"
],"metrics_collection_interval": 60,"resources": [
"*"
]
},"Processor": {
"measurement": [
{"name": "% Idle Time","rename": "CPU_IDLE","unit": "Percent"},"% User Time","% Processor Time","% Interrupt Time"
],"resources": [
"*"
]
}
}
},"logs": {
"logs_collected": {
"files": {
"collect_list": [
{
"file_path": "C:\\programdata\\Amazon\\AmazonCloudWatchAgent\\amazon-cloudwatch-agent.log","log_group_name": "`{"Fn::Join":[ "/",["/elasticbeanstalk",{ "Ref":"AWSEBEnvironmentName" } ]]}`","log_stream_name": "{instance_id}-cloudwatch-agent"
},{
"file_path": "C:\\inetpub\\logs\\LogFiles\\W3SVC1\\*.log","log_stream_name": "{instance_id}-IIS-Log"
},{
"file_path": "C:\\cfn\\log\\cfn-wire.log","log_group_name":"`{"Fn::Join":[ "/","log_stream_name": "{instance_id}-cfn-wire"
},{
"file_path": "C:\\cfn\\log\\cfn-init.log","log_stream_name": "{instance_id}-cfn-init"
}
]
},"windows_events": {
"collect_list": [
{
"event_format": "text","event_levels": [
"VERBOSE","INFORMATION","WARNING","ERROR","CRITICAL"
],"event_name": "System","log_stream_name": "{instance_id}-WindowsSystemEvents"
},{
"event_format": "text","event_name": "Application","log_stream_name": "{instance_id}-ApplicationEvents"
}
]
}
}
}
}
container_commands:
01_stop_service:
command: powershell -NoProfile -ExecutionPolicy Bypass -Command "C:\\'Program Files'\\Amazon\\AmazonCloudWatchAgent\\amazon-cloudwatch-agent-ctl.ps1 -a stop"
ignoreErrors: true
waitAfterCompletion: 10
02_start_service:
command: powershell -NoProfile -ExecutionPolicy Bypass -Command "C:\\'Program Files'\\Amazon\\AmazonCloudWatchAgent\\amazon-cloudwatch-agent-ctl.ps1 -a fetch-config -m ec2 -c file:C:\\programdata\\Amazon\\AmazonCloudWatchAgent\\amazon-cloudwatch-agent.json -s"
ignoreErrors: true
waitAfterCompletion: 10

有什么建议吗?





推荐阅读
author-avatar
美美2012的小幸福
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有