- 최신
- 최다 투표
- 가장 많은 댓글
If the log driver is awslogs, logs can be output to CloudWatch logs by setting the output destination to "/dev/stdout" or "/dev/stderr".
https://repost.aws/knowledge-center/ecs-container-logs-cloudwatch
The awslogs log driver simply passes the container logs that are the STDOUT and STDERR I/O streams from Docker to CloudWatch Logs. Therefore, verify that your application sends the logs to STDOUT and STDERR I/O streams. Be sure to set the correct log level for your application during the container build. Depending on your application, you might set the log level through an environment variable or a configuration file.
So, if you output "/home/my-app/application.log" to "/dev/stdout", you can check it in CloudWatch logs.
Initially I assumed I would need to change all my logger statements in the processes that log. Found another solution online. Add the below line to send the logs to stdout in the Dockerfile.
RUN ln -sf /proc/1/fd/1 /home/my-app/application.log
관련 콘텐츠
- AWS 공식업데이트됨 2년 전
- AWS 공식업데이트됨 일 년 전
- AWS 공식업데이트됨 일 년 전