目前使用Amazon Web服务,我成功地在Elastic Beanstalk(具有绿色集群运行状况)上部署了多个应用程序作为Docker容器.
但是当我尝试使用控制台获取日志时会出现问题;当我做“请求日志”时,没有找到日志.当我在请求日志后返回仪表板时,出现了一个新的事件/错误:
[Instance: i-123456789] Command Failed on instance. Return code: 1 Output: bundleLogs.py –conf-path ‘/opt/elasticbeanstalk/tasks/bundlelogs.d/*’ –location-prefix ‘resources/environments/logs/bundle/’ Unable to execute method publish_contents_from_filename on any of the target objects. For more detail,check /var/log/eb-activity.log using console or EB CLI.
为了解决这个问题,我通过SSH连接到我的集群并使用以下命令在我的Docker容器中查找日志:
sudo docker exec myinstance cat /var/log/logstash_activity.log
我的日志按预期发现.
为了更多地了解错误,我看了一下/var/log/eb-activity.log并找到了以下几行:
[2015-07-06T12:54:30.137Z] INFO [26993] - [CMD-BundleLogs] : Starting activity...
[2015-07-06T12:54:30.363Z] INFO [26993] - [CMD-BundleLogs/AddonsBefore] : Starting activity...
[2015-07-06T12:54:30.363Z] INFO [26993] - [CMD-BundleLogs/AddonsBefore] : Completed activity.
[2015-07-06T12:54:30.363Z] INFO [26993] - [CMD-BundleLogs/BundleLogs] : Starting activity...
[2015-07-06T12:54:30.364Z] INFO [26993] - [CMD-BundleLogs/BundleLogs/BundleLogs] : Starting activity...
[2015-07-06T12:54:30.627Z] INFO [26993] - [CMD-BundleLogs/BundleLogs/BundleLogs] : Activity execution Failed,because: bundleLogs.py --conf-path '/opt/elasticbeanstalk/tasks/bundlelogs.d/*' --location-prefix 'resources/environments/logs/bundle/'
Unable to execute method publish_contents_from_filename on any of the target objects (Executor::NonZeroExitStatus)
[2015-07-06T12:54:30.627Z] INFO [26993] - [CMD-BundleLogs/BundleLogs/BundleLogs] : Activity Failed.
[2015-07-06T12:54:30.627Z] INFO [26993] - [CMD-BundleLogs/BundleLogs] : Activity Failed.
[2015-07-06T12:54:30.627Z] INFO [26993] - [CMD-BundleLogs] : Completed activity. Result:
Command CMD-BundleLogs Failed.
然而,错误消息对我没有多大帮助.
在我的Dockerrun.aws.json的“Logging”字段中,我给出了路径“/ var / log”,因为它是包含我的app日志的文件夹等.我还尝试了值“/var/log/logstash_activity.log”而没有取得更多成功.
为什么Beanstalk控制台无法找到我的应用程序日志?