Question:
When I request the log files for an elastic beanstalk environment either through the web interface or “eb logs” I get the contents of the log files /var/log/eb-version-deployment.log, /opt/python/log/httpd.out, /var/log/cfn-hup.log, and several others.
Is there a way to add an additional log such as test_output.log to logs collected by the web interface and “eb logs”?
Answer:
Elastic Beanstalk looks in this folder for configuration files regarding which logs to tail:
1 2 |
/opt/elasticbeanstalk/tasks/taillogs.d/ |
On my box there are a handful of files there
1 2 3 4 5 6 7 8 9 10 11 |
[ec2-user@ip taillogs.d]$ ls -al total 32 drwxr-xr-x 2 root root 4096 Sep 27 05:49 . drwxr-xr-x 6 root root 4096 Sep 27 05:49 .. -rw-r--r-- 1 root root 58 Sep 27 05:49 eb-activity.conf -rw-r--r-- 1 root root 35 Sep 27 05:49 eb-version-deployment.conf -rw-r--r-- 1 root root 16 Oct 15 03:44 httpd.conf -rw-r--r-- 1 root root 16 Oct 15 03:44 nginx.conf -rw-r--r-- 1 root root 26 Oct 15 03:44 nodejs.conf -rw-r--r-- 1 root root 29 Oct 15 03:44 npm.conf |
And each one has one line in it, like this:
1 2 |
/var/log/nodejs/nodejs.log |
or
1 2 |
/var/log/nginx/* |
Use .ebextensions
to add a config file to tail your own logs:
1 2 3 4 5 6 7 8 |
files: "/opt/elasticbeanstalk/tasks/taillogs.d/my-app-logs.conf": mode: "000755" owner: root group: root content: | /var/log/my-app.log |
More info here:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.logging.html#health-logs-extend