friartuck
friartuck

Reputation: 3121

Viewing node.js logs (console.log) from docker-compose deployment on elastic beanstalk

New to docker and EBS. I have deployed my application to elastic beanstalk using docker-compose. Wondering how I can view the output of calling console.log() in my node.js app. Pulling the generic logs from the EBS console doesn't give me anything. I tried SSHing into the instance but poking around the filesystem, including under the /var/log folder

[ec2-user@ip-172-31-18-51 log]$ ls -a
.         cfn-hup.log       cloud-init.log         docker-compose-events.log  eb-engine.log   messages  wtmp
..        cfn-init-cmd.log  cloud-init-output.log  docker-events.log          eb-publish.log  nginx     xray
amazon    cfn-init.log      cron                   eb-cfn-init-call.log       eb-tools.log    rotated
boot.log  cfn-wire.log      dmesg                  eb-cfn-init.log            healthd         sa
btmp      chrony            docker                 eb-docker                  maillog         secure

Apparently there should be a nodejs folder /var/log/nodejs or /var/log/web.stdout.log (AWS Elastic Beanstalk NodeJS and logs)

but I cannot see either.

Upvotes: 1

Views: 3061

Answers (1)

Duc Trung Mai
Duc Trung Mai

Reputation: 2598

To view your NodeJS console.log you simple use:

docker compose logs <node_service_name_in_docker-compose.yml>

# add "-f" if you want to see realtime logs

(run in where your docker-compose.yml is located)

Upvotes: 3

Related Questions