Reputation: 14859
I'm posting this as a question and answer, as I think many people may experience the same issue.
I've had an Elastic Beanstalk instance streaming logs to CloudWatch for over a year. Recently, my logs stopped appearing in CloudWatch. The Elastic Beanstalk instance is logging to its container correctly, and I have made no changes to my logging configurations.
Upvotes: 1
Views: 459
Reputation: 14859
TLDR;
The most recent Java/Tomcat8 Elastic Beanstalk environment includes boto3. My .ebextensions/sshd.config file installs boto3, and this was causing a conflict. Removing the boto3 line from my sshd.config solved the issue.
Full Answer
I started my project as a Java/Tomcat Codestar template. This project includes the file .ebextensions/sshd.config which looks like this:
packages:
yum:
python27-devel: []
python27-pip: []
gcc: []
python:
pycrypto: []
boto3: []
files:
"/usr/local/bin/get_authorized_keys" :
mode: "000755"
owner: root
group: root
source: https://s3.amazonaws.com/awscodestar-remote-access-us-east-1/get_authorized_keys
commands:
01_update_ssh_access:
command: >
sed -i '/AuthorizedKeysCommand /s/.*/AuthorizedKeysCommand \/usr\/local\/bin\/get_authorized_keys/g' /etc/ssh/sshd_config &&
sed -i '/AuthorizedKeysCommandUser /s/.*/AuthorizedKeysCommandUser root/g' /etc/ssh/sshd_config &&
/etc/init.d/sshd restart
The script installs python and boto3 into the Elastic Beanstalk instance.
Through AWS support I found out the latest Java/Tomcat environment already includes boto3, and trying to install this on top of the existing environment was causing a problem. This ultimately resulted in the instance logs failing to stream to CloudWatch.
The solution was simply to remove the explicit install of boto3 in the sshd.config, then rebuild the Elastic Beanstalk instance and redeloy my app.
I just tried creating a new Codestar Java/Tomcat template project, and the boto3 install line is still in the sshd.config.
I have not checked other types of project to see if the same sshd.config is included in the Codestar template. I assume this is probably not specific to the Java/Tomcat environment.
Upvotes: 1