Skip to content

Commit

Permalink
Merge pull request #54 from dnd-side-project/feat/#52
Browse files Browse the repository at this point in the history
#52 운영 서버 모니터링 구축
  • Loading branch information
min-0 authored Sep 24, 2024
2 parents 6fc5e97 + b2f99b0 commit 22f7e5b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ dependencies {
// Swagger
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.1.0'

//AWS CloudWatch
implementation 'ca.pjer:logback-awslogs-appender:1.6.0'

compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ spring:
logging:
level:
root: INFO # 로그 레벨 설정
file:
name: /home/ec-user/mapddnag-back/spring-boot-app.log
pattern:
file: "%d{yyyy-MM-dd HH:mm:ss} - %msg%n"

social-login:
provider:
Expand Down
23 changes: 23 additions & 0 deletions src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<include resource="org/springframework/boot/logging/logback/console-appender.xml" />

<appender name="aws_cloudwatch_log" class="ca.pjer.logback.AwsLogsAppender">
<layout>
<pattern>[%thread] [%date] [%level] [%file:%line] - %msg%n</pattern>
</layout>
<logGroupName>mapddang-log-prod</logGroupName>
<logStreamUuidPrefix>mapddang-prod</logStreamUuidPrefix>
<logRegion>your-aws-region</logRegion>
<maxBatchLogEvents>50</maxBatchLogEvents>
<maxFlushTimeMillis>30000</maxFlushTimeMillis>
<maxBlockTimeMillis>5000</maxBlockTimeMillis>
<retentionTimeDays>0</retentionTimeDays>
</appender>

<root level="INFO">
<appender-ref ref="console" />
<appender-ref ref="aws_cloudwatch_log" />
</root>
</configuration>

0 comments on commit 22f7e5b

Please sign in to comment.