在 EC2 实例初始化时查找日志
Looking for logs when an instance of EC2 is initializing
我正在使用 openshift-ansible (https://github.com/openshift/openshift-ansible),它是根据我们的需要部分定制的。启动实例的部分已修改为设置 group_id 其中没有任何更改。
创建主 openshift 时一切正常。但是,在创建 2 个 openshift 节点时,我可以看到在 EC2 仪表板的 "Running instance" 面板中创建了 2 个实例。实例在 Initializing 状态下持续几秒钟,然后自动切换到 "Shutting down"
Ansible 这边仍在执行启动实例的任务。所以我的问题是:
有没有办法在创建新实例时分析 AWS 实例的日志?
最后一个 ansible 任务的日志:
TASK: [Launch instance(s)]
**************************************************** REMOTE_MODULE ec2 region=eu-west-1 keypair=ggkey1-eu-west
state=present instance_type=m3.large user_data='#cloud-config mounts:
- [ xvdb ] - [ ephemeral0 ] write_files: - content: | DEVS=/dev/xvdb VG=docker_vg path: /etc/sysconfig/docker-storage-setup owner:
root:root permissions: '"'"'0644'"'"' ' vpc_subnet_id=subnet-60cf1205
image=ami-33ba2a44 count=2 EXEC ['/bin/sh', '-c', 'mkdir
-p $HOME/.ansible/tmp/ansible-tmp-1441977401.88-262307796372076 && echo $HOME/.ansible/tmp/ansible-tmp-1441977401.88-262307796372076']
PUT /tmp/tmp4r8qve TO
/root/.ansible/tmp/ansible-tmp-1441977401.88-262307796372076/ec2
EXEC ['/bin/sh', '-c', u'LANG=C LC_CTYPE=C /usr/bin/env
python2
/root/.ansible/tmp/ansible-tmp-1441977401.88-262307796372076/ec2; rm
-rf /root/.ansible/tmp/ansible-tmp-1441977401.88-262307796372076/ >/dev/null 2>&1'] failed: [localhost] => {"failed": true} msg: wait for instances running timeout on Fri Sep 11 13:21:43 2015
$ ansible --version
ansible 1.9.2
configured module search path = None
$ uname -a
Linux ip-172-31-42-45 3.10.0-123.8.1.el7.x86_64 #1 SMP Mon Sep 22 19:06:58 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
root@ip-172-31-42-45 : ~/uha-rbox-spawner$
谢谢,
Is there a way to analyze logs of the instances of AWS when new instances are being created ?
您正在寻找“get console output”。您可以在 AWS (http) 控制台中看到它,或者您可以从 awscli 或您选择的 API 中获取它。
"get console output" 有点令人困惑,因为 AWS 控制台也是 "console"。将其视为 "system logs"(如控制台所做的那样),或简称为 "what would show on a screen in a datacenter".
我正在使用 openshift-ansible (https://github.com/openshift/openshift-ansible),它是根据我们的需要部分定制的。启动实例的部分已修改为设置 group_id 其中没有任何更改。
创建主 openshift 时一切正常。但是,在创建 2 个 openshift 节点时,我可以看到在 EC2 仪表板的 "Running instance" 面板中创建了 2 个实例。实例在 Initializing 状态下持续几秒钟,然后自动切换到 "Shutting down"
Ansible 这边仍在执行启动实例的任务。所以我的问题是:
有没有办法在创建新实例时分析 AWS 实例的日志?
最后一个 ansible 任务的日志:
TASK: [Launch instance(s)] **************************************************** REMOTE_MODULE ec2 region=eu-west-1 keypair=ggkey1-eu-west state=present instance_type=m3.large user_data='#cloud-config mounts: - [ xvdb ] - [ ephemeral0 ] write_files: - content: | DEVS=/dev/xvdb VG=docker_vg path: /etc/sysconfig/docker-storage-setup owner: root:root permissions: '"'"'0644'"'"' ' vpc_subnet_id=subnet-60cf1205 image=ami-33ba2a44 count=2 EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1441977401.88-262307796372076 && echo $HOME/.ansible/tmp/ansible-tmp-1441977401.88-262307796372076'] PUT /tmp/tmp4r8qve TO /root/.ansible/tmp/ansible-tmp-1441977401.88-262307796372076/ec2 EXEC ['/bin/sh', '-c', u'LANG=C LC_CTYPE=C /usr/bin/env python2 /root/.ansible/tmp/ansible-tmp-1441977401.88-262307796372076/ec2; rm -rf /root/.ansible/tmp/ansible-tmp-1441977401.88-262307796372076/ >/dev/null 2>&1'] failed: [localhost] => {"failed": true} msg: wait for instances running timeout on Fri Sep 11 13:21:43 2015
$ ansible --version
ansible 1.9.2 configured module search path = None
$ uname -a
Linux ip-172-31-42-45 3.10.0-123.8.1.el7.x86_64 #1 SMP Mon Sep 22 19:06:58 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux root@ip-172-31-42-45 : ~/uha-rbox-spawner$
谢谢,
Is there a way to analyze logs of the instances of AWS when new instances are being created ?
您正在寻找“get console output”。您可以在 AWS (http) 控制台中看到它,或者您可以从 awscli 或您选择的 API 中获取它。
"get console output" 有点令人困惑,因为 AWS 控制台也是 "console"。将其视为 "system logs"(如控制台所做的那样),或简称为 "what would show on a screen in a datacenter".