Skip to content

Commit

Permalink
infra: promtail 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoya324 committed Dec 5, 2024
1 parent 935a1c5 commit 8f73479
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 2 deletions.
3 changes: 1 addition & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ services:
promtail:
depends_on:
- maru-egg-app
- loki
container_name: promtail
image: grafana/promtail:latest
restart: always
Expand All @@ -40,7 +39,7 @@ services:
command:
- -config.file=/etc/promtail/promtail-config.yml
networks:
- monitor-net
- maru-egg-dev

networks:
maru-egg-dev:
55 changes: 55 additions & 0 deletions src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<configuration>
<!-- 전체 설정의 시작 -->

<!-- INFO 이상 모든 로그를 기록할 Appender -->
<appender name="ALL_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/all/logFile.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/all/logFile.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>30</maxHistory>
<totalSizeCap>100MB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
</appender>

<!-- WARN 레벨 이상의 로그만 기록할 Appender -->
<appender name="WARN_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/warn/logFile.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/warn/logFile.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>30</maxHistory>
<totalSizeCap>100MB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
</filter>
</appender>

<!-- ERROR 레벨 이상의 로그만 기록할 Appender -->
<appender name="ERROR_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/error/logFile.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/error/logFile.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>30</maxHistory>
<totalSizeCap>100MB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>

<!-- Root Logger 설정 -->
<root level="INFO">
<appender-ref ref="ALL_LOG"/>
<appender-ref ref="WARN_LOG"/>
<appender-ref ref="ERROR_LOG"/>
</root>
</configuration>

0 comments on commit 8f73479

Please sign in to comment.