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"?
Logs created by the web server, application server, Elastic Beanstalk platform scripts, and AWS CloudFormation are stored locally on individual instances. You can easily retrieve them by using the environment management console or the EB CLI.
Elastic Beanstalk creates a bucket named elasticbeanstalk- region - account-id for each AWS Region in which you create environments. Within this bucket, logs are stored under the path resources/environments/logs/ logtype / environment-id / instance-id .
To see your log data, sign in to the AWS Management Console, and open the CloudWatch console. In the left navigation pane, choose the Logs tab. Find your log group in the list of groups and open the log group. Your log group name is the Name that you set when you set up logging in the Amazon OpenSearch Service wizard.
Elastic Beanstalk looks in this folder for configuration files regarding which logs to tail:
/opt/elasticbeanstalk/tasks/taillogs.d/
On my box there are a handful of files there
[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:
/var/log/nodejs/nodejs.log
or
/var/log/nginx/*
Use .ebextensions
to add a config file to tail your own logs:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With