docker-compose의 로그를 혼잡하게 CloudWatch에 던지기
logging의 awslogs driver를 사용해 보았습니다.
경위
환경
docker-compose.yml
logging:
driver: "awslogs"
options:
awslogs-region: "ap-northeast-1"
awslogs-group: "${RAILS_ENV}"
awslogs-stream: "nginx"
Dockerfile
RUN ln -sf /dev/stdout /var/log/HOGOHOGE/app-access.log
RUN ln -sf /dev/stderr /var/log/HOGEHOGE/app-error.log
cloud watch
ERROR: for redis Cannot start service redis: Failed to initialize logging driver: ResourceNotFoundException: The specified log group does not exist.
status code: 400, request id: xxxxxx-xxxxxxxxx-xxxxxxxx-xxxxx
ERROR: for db Cannot start service db: Failed to initialize logging driver: ResourceNotFoundException: The specified log group does not exist.
status code: 400, request id: xxxxxx-xxxxxxxxx-xxxxxxxx-xxxxx
움직여 보자
$ docker-compose up
로그 집계 가능
docker-compose.yml 전체 (db와 redis에는 의미가 없습니다)
docker-compose.yml
version: '2'
services:
web:
image: nginx
depends_on:
- db
- redis
ports:
- "80:80"
logging:
driver: "awslogs"
options:
awslogs-region: "ap-northeast-1"
awslogs-group: "develop"
awslogs-stream: "nginx"
redis:
image: redis
logging:
driver: "awslogs"
options:
awslogs-region: "ap-northeast-1"
awslogs-group: "develop"
awslogs-stream: "redis"
db:
image: postgres
logging:
driver: "awslogs"
options:
awslogs-region: "ap-northeast-1"
awslogs-group: "develop"
awslogs-stream: "posgre"
요약
그리고의 해석은 또, cloudwatch로부터 무언가에 던지면 좋을까-와! !
Reference
이 문제에 관하여(docker-compose의 로그를 혼잡하게 CloudWatch에 던지기), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/okamu_/items/f99732c4af0ffb1cb3d7텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)