From 5cb846f9309df110745b2dfe69d1ed57b7d5f394 Mon Sep 17 00:00:00 2001 From: Oniqued Date: Sat, 19 Oct 2024 16:05:50 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat(logback)=20:=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EB=B0=B1=20=EC=84=A4=EC=A0=95=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- .../resources/log/config/error-config.xml | 57 -------- src/main/resources/log/config/info-config.xml | 52 ------- src/main/resources/log/config/warn-config.xml | 61 -------- src/main/resources/logback-dev.xml | 35 ----- src/main/resources/logback-prod.xml | 12 -- src/main/resources/logback-spring.xml | 134 ++++++++++++++++-- 7 files changed, 126 insertions(+), 227 deletions(-) delete mode 100644 src/main/resources/log/config/error-config.xml delete mode 100644 src/main/resources/log/config/info-config.xml delete mode 100644 src/main/resources/log/config/warn-config.xml delete mode 100644 src/main/resources/logback-dev.xml delete mode 100644 src/main/resources/logback-prod.xml diff --git a/.gitignore b/.gitignore index 0eb9aad1..01ef7c5c 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,4 @@ out/ .vscode/ ### LOG ### -/src/main/resources/log/history/** +/logs diff --git a/src/main/resources/log/config/error-config.xml b/src/main/resources/log/config/error-config.xml deleted file mode 100644 index 353168c0..00000000 --- a/src/main/resources/log/config/error-config.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - ERROR - ACCEPT - DENY - - - - - - - level - - - - - - - - - yyyy-MM-dd'T'HH:mm:ss.SSSSSS - - - - - logger - - - - - message - - - - - stacktrace - - - - - - - - - - src/main/resources/log/history/%d{yyyy-MM-dd}/error-%d{yyyy-MM-dd}.log.zip - - - 30 - - - 5GB - - - diff --git a/src/main/resources/log/config/info-config.xml b/src/main/resources/log/config/info-config.xml deleted file mode 100644 index 50615bf3..00000000 --- a/src/main/resources/log/config/info-config.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - INFO - ACCEPT - DENY - - - - - - - level - - - - - - - - - yyyy-MM-dd'T'HH:mm:ss.SSSSSS - - - - - message - - - - - stacktrace - - - - - - - - - - home/ec2-user/log/history/%d{yyyy-MM-dd}/info-%d{yyyy-MM-dd}.log.zip - - - 30 - - - 5GB - - - diff --git a/src/main/resources/log/config/warn-config.xml b/src/main/resources/log/config/warn-config.xml deleted file mode 100644 index a1a7d979..00000000 --- a/src/main/resources/log/config/warn-config.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - WARN - ACCEPT - DENY - - - - - - - - - - level - - - - - yyyy-MM-dd'T'HH:mm:ss.SSSSSS - - - - - thread - - - - - logger - - - - - message - - - - - stacktrace - - - - - - - - - - src/main/resources/log/history/%d{yyyy-MM-dd}/warn-%d{yyyy-MM-dd}.log.zip - - - 30 - - - 5GB - - - diff --git a/src/main/resources/logback-dev.xml b/src/main/resources/logback-dev.xml deleted file mode 100644 index e771b953..00000000 --- a/src/main/resources/logback-dev.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - ${CONSOLE_LOG_PATTERN} - ${CONSOLE_LOG_CHARSET} - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/logback-prod.xml b/src/main/resources/logback-prod.xml deleted file mode 100644 index a033d5d5..00000000 --- a/src/main/resources/logback-prod.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index e771b953..d8442e68 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -1,5 +1,6 @@ + @@ -8,12 +9,6 @@ - - - ${CONSOLE_LOG_PATTERN} - ${CONSOLE_LOG_CHARSET} - - @@ -29,7 +24,128 @@ - - - + + + + ${CONSOLE_LOG_PATTERN} + ${CONSOLE_LOG_CHARSET} + + + + + + + + + + + INFO + ACCEPT + DENY + + ${LOG_PATH}/${LOG_FILE_NAME}.log + + + + + level + + + + + + + + + yyyy-MM-dd'T'HH:mm:ss.SSSSSS + + + + + message + + + + + stacktrace + + + + + + + ${LOG_PATH}/${LOG_FILE_NAME}.%d{yyyy-MM-dd}.gz + 30 + 1GB + + + + + + + ERROR + ACCEPT + DENY + + ${LOG_PATH}/${ERR_LOG_FILE_NAME}.log + + + + + level + + + + + + + + + yyyy-MM-dd'T'HH:mm:ss.SSSSSS + + + + + logger + + + + + message + + + + + stacktrace + + + + + + + ${LOG_PATH}/${ERR_LOG_FILE_NAME}.%d{yyyy-MM-dd}.gz + 30 + 1GB + + + + + + logstash:50000 + + + + + + + + + + + + + + + + From bcb5f3857c82e765757698409e4f2022981a6db2 Mon Sep 17 00:00:00 2001 From: Oniqued Date: Sat, 19 Oct 2024 16:06:12 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix(Dockerfile)=20:=20=EB=A1=9C=EA=B7=B8=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5=20=EB=B3=BC=EB=A5=A8=20=EC=9E=AC=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 943c1858..11b23b79 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ FROM openjdk:17-ea-11-jdk-slim -VOLUME /tmp +VOLUME /logs COPY build/libs/backend-0.0.1-SNAPSHOT.jar FriendShip.jar ENTRYPOINT ["java", "-jar", "FriendShip.jar"] \ No newline at end of file From 14889d0cf8bfabc4a7e3e2b82abbaba0c290953a Mon Sep 17 00:00:00 2001 From: Oniqued Date: Sat, 19 Oct 2024 16:08:34 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix(friendship-pipeline.yml)=20:=20docker?= =?UTF-8?q?=20run=20=EC=8B=9C,=20=EB=B3=BC=EB=A5=A8=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/friendship-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/friendship-pipeline.yml b/.github/workflows/friendship-pipeline.yml index ad5549fb..84fbae09 100644 --- a/.github/workflows/friendship-pipeline.yml +++ b/.github/workflows/friendship-pipeline.yml @@ -91,7 +91,7 @@ jobs: sudo docker rm friendship || true # 새 friendship 컨테이너 실행 - sudo docker run -d --log-driver=syslog -p 443:8080 --name friendship --network friendship-network -e spring.profiles.active=prod -e TZ=Asia/Seoul ${{ secrets.DOCKER_USERNAME }}/${{ env.APP_NAME }}:latest + sudo docker run -v /home/ec2-user/elk/logs:/logs -d --log-driver=syslog -p 443:8080 --name friendship --network friendship-network -e spring.profiles.active=prod -e TZ=Asia/Seoul ${{ secrets.DOCKER_USERNAME }}/${{ env.APP_NAME }}:latest # friendship 관련 종료된 컨테이너 삭제 sudo docker container prune -f