feat(loki): send logs to loki to centralize logs

This commit is contained in:
tiennm99 committed 2025-11-13 18:24:13 +07:00
1 parent ec9ad27f09
commit 0f5fdca3e7
3 files changed
+23

No files matched your search

+16
View File
@@ -3,6 +3,8 @@
<Properties>
<Property name="CONSOLE_LOG_PATTERN">%d{HH:mm:ss.SSS} %5p --- [%t] %c : %m%n</Property>
<Property name="CONSOLE_LOG_CHARSET">UTF-8</Property>
<Property name="LOKI_LOG_PATTERN">%d{yyyy-MM-dd HH:mm:ss.SSS} %5p --- [%t] %c : %m%n</Property>
<Property name="LOKI_LOG_CHARSET">UTF-8</Property>
</Properties>
<Appenders>
@@ -12,10 +14,24 @@
<ThresholdFilter level="TRACE"/>
</Filters>
</Console>
<Loki name="Loki">
<host>${env:LOKI_HOST}</host>
<port>${env:LOKI_PORT}</port>
<username>${env:LOKI_USERNAME}</username>
<password>${env:LOKI_PASSWORD}</password>
<PatternLayout pattern="${LOKI_LOG_PATTERN}" charset="${LOKI_LOG_CHARSET}"/>
<Label name="service_name" value="StoreScraperBot"/>
<Label name="environment" value="${env:ENV}"/>
</Loki>
</Appenders>
<Loggers>
<Root level="${env:LOG_LEVEL:-debug}">
<AppenderRef ref="ConsoleAppender"/>
<AppenderRef ref="Loki"/>
</Root>
</Loggers>
</Configuration>