Skip to content

Commit 2aefde3

Browse files
committed
infra: loki, prometheus 설정 (#193)
1 parent e554851 commit 2aefde3

File tree

7 files changed

+64
-7
lines changed

7 files changed

+64
-7
lines changed

.github/workflows/yappu-oci-dev-cd.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- dev
7-
- infra/oci-cd
87

98
jobs:
109
build:

.github/workflows/yappu-oci-prod-cd.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- prod
7-
- infra/oci-cd
87

98
jobs:
109
build:

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ dependencies {
5454

5555
// logging
5656
implementation("io.github.oshai:kotlin-logging-jvm:7.0.0")
57+
implementation("com.github.loki4j:loki-logback-appender:2.0.1")
5758

5859
// swagger
5960
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.7.0")

src/main/resources/application-dev-oci.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,13 @@ sentry:
5151

5252
management:
5353
endpoints:
54+
enabled-by-default: true
5455
web:
5556
exposure:
56-
include: prometheus
57+
include: health, info, prometheus
58+
endpoint:
59+
health:
60+
show-details: always
5761

5862
logging:
5963
level:

src/main/resources/application-prod-oci.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,13 @@ sentry:
5151

5252
management:
5353
endpoints:
54+
enabled-by-default: true
5455
web:
5556
exposure:
56-
include: prometheus
57+
include: health, info, prometheus
58+
endpoint:
59+
health:
60+
show-details: when-authorized
5761

5862
logging:
5963
level:

src/main/resources/application.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ spring:
77
local: console-logging, secret-local
88
test: console-logging
99
dev: console-logging
10-
dev-oci: console-logging
11-
prod: console-logging, sentry-logging
12-
prod-oci: console-logging, sentry-logging
10+
dev-oci: dev-loki
11+
prod: console-logging
12+
prod-oci: prod-loki

src/main/resources/logback-spring.xml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,54 @@
88
<appender-ref ref="CONSOLE" />
99
</root>
1010
</springProfile>
11+
12+
<springProfile name="dev-loki">
13+
<appender name="LOKI" class="com.github.loki4j.logback.Loki4jAppender">
14+
<http>
15+
<url>http://10.0.0.119:3100/loki/api/v1/push</url>
16+
</http>
17+
<labels>
18+
app=yappu-world
19+
host=${HOSTNAME}
20+
level=%level
21+
env=dev
22+
</labels>
23+
<message>
24+
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
25+
</message>
26+
</appender>
27+
28+
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
29+
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
30+
31+
<root level="INFO">
32+
<appender-ref ref="CONSOLE" />
33+
<appender-ref ref="LOKI" />
34+
</root>
35+
</springProfile>
36+
37+
<springProfile name="prod-loki">
38+
<appender name="LOKI" class="com.github.loki4j.logback.Loki4jAppender">
39+
<http>
40+
<url>http://10.0.0.119:3100/loki/api/v1/push</url>
41+
</http>
42+
<labels>
43+
app=yappu-world
44+
host=${HOSTNAME}
45+
level=%level
46+
env=prod
47+
</labels>
48+
<message>
49+
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
50+
</message>
51+
</appender>
52+
53+
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
54+
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
55+
56+
<root level="INFO">
57+
<appender-ref ref="CONSOLE" />
58+
<appender-ref ref="LOKI" />
59+
</root>
60+
</springProfile>
1161
</configuration>

0 commit comments

Comments
 (0)