From 7e7e40a67741438289319650f0f5a4d0812d9d76 Mon Sep 17 00:00:00 2001 From: Nivesh Krishna Date: Wed, 22 Feb 2023 17:45:42 +0530 Subject: [PATCH 1/2] move docker logs to syslog --- .env.prod | 1 - docker-compose.prod.yml | 18 ++++++++---------- etc/nginx/nginx.conf | 4 ++-- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.env.prod b/.env.prod index 024b6f172..9ed4a2762 100644 --- a/.env.prod +++ b/.env.prod @@ -13,4 +13,3 @@ CI_REGISTRY_IMAGE=image SENTRY_DSN=public_key:gitlab.com SENTRY_TRACES_SAMPLE_RATE=1.0 ENVIRONMENT_NAME=prod -LOG_DIRECTORY=/volumes/spot-nginx-log/ diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index e2f9f614a..2e09e743d 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,17 +1,9 @@ version: '3.6' -x-logging: - &default-logging - options: - max-size: '100m' - max-file: '3' - driver: json-file - services: redis: image: redis:5.0.7-alpine # container_name: spot-redis - logging: *default-logging restart: always networks: - ${INTERNAL_NETWORK_NAME} @@ -22,7 +14,10 @@ services: build: context: . dockerfile: Dockerfile - logging: *default-logging + logging: + driver: syslog + options: + tag: docker-${ENVIRONMENT_NAME}-spot restart: always networks: - ${INTERNAL_NETWORK_NAME} @@ -42,6 +37,10 @@ services: spot-nginx: image: nginx:1.23 restart: always + logging: + driver: syslog + options: + tag: docker-${ENVIRONMENT_NAME}-nginx networks: - ${INTERNAL_NETWORK_NAME} volumes: @@ -49,7 +48,6 @@ services: - ./etc/nginx/nginx.conf:/etc/nginx/nginx.conf - ./etc/nginx/proxy_spot_params:/etc/nginx/proxy_spot_params - ./searx/static:/var/www/spot/static - - ${LOG_DIRECTORY}:/var/log/nginx filtron: image: dalf/filtron:latest diff --git a/etc/nginx/nginx.conf b/etc/nginx/nginx.conf index d0e73015a..9621f159f 100644 --- a/etc/nginx/nginx.conf +++ b/etc/nginx/nginx.conf @@ -18,8 +18,8 @@ http { '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$remote_addr"'; - access_log /var/log/nginx/access.log main; - error_log /var/log/nginx/error.log warn; + error_log stderr warn; + access_log /dev/stdout main; sendfile on; #tcp_nopush on; -- GitLab From b95886d6548bda6dafc27a9604c605a2ce162e94 Mon Sep 17 00:00:00 2001 From: Nivesh Krishna Date: Wed, 22 Feb 2023 19:12:16 +0530 Subject: [PATCH 2/2] rename logging tag --- docker-compose.prod.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 2e09e743d..0323f62e1 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -17,7 +17,7 @@ services: logging: driver: syslog options: - tag: docker-${ENVIRONMENT_NAME}-spot + tag: docker-${ENVIRONMENT_NAME}-spot-app restart: always networks: - ${INTERNAL_NETWORK_NAME} @@ -40,7 +40,7 @@ services: logging: driver: syslog options: - tag: docker-${ENVIRONMENT_NAME}-nginx + tag: docker-${ENVIRONMENT_NAME}-spot-nginx networks: - ${INTERNAL_NETWORK_NAME} volumes: -- GitLab