chore: jsonのログを見れるように

This commit is contained in:
usbharu 2024-09-12 22:02:04 +09:00
parent 72659bf57b
commit 0dcd2b1b9a
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
7 changed files with 88 additions and 17 deletions

View File

@ -0,0 +1,60 @@
version: "3"
services:
db:
image: postgres:16
ports:
- "5432:5432"
environment:
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "password"
POSTGRES_DB: "hideout"
mongodb:
image: mongo:7.0.14
ports:
- "27017:27017"
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.24
container_name: elasticsearch
environment:
- discovery.type=single-node
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- xpack.security.enabled=true
- xpack.monitoring.collection.enabled=true
- ELASTIC_PASSWORD=Passw0rd
- "ES_JAVA_OPTS=-Xms512M -Xmx512M"
ports:
- "9200:9200"
volumes:
- elasticsearch-data:/usr/share/elasticsearch/data
restart: always
kibana:
image: docker.elastic.co/kibana/kibana:7.17.24
container_name: kibana
ports:
- "5601:5601"
environment:
- ELASTICSEARCH_URL=http://elasticsearch:9200
- ELASTICSEARCH_USERNAME=elastic
- ELASTICSEARCH_PASSWORD=Passw0rd
depends_on:
- elasticsearch
restart: always
fluentd:
build: ./fluentd
volumes:
- ./fluentd/conf:/fluentd/etc
- ../logs:/in
depends_on:
- "elasticsearch"
ports:
- "24224:24224"
- "24224:24224/udp"
volumes:
elasticsearch-data:
driver: local

View File

@ -0,0 +1,4 @@
FROM fluent/fluentd:v1.16-debian-2
USER root
RUN fluent-gem install fluent-plugin-elasticsearch --no-document
USER fluent

View File

@ -0,0 +1,19 @@
<source>
@type tail
path /in/logFile.log.json
pos_file /in/logFile.pos
tag hideout
<parse>
@type json
</parse>
</source>
<match hideout>
@type elasticsearch
host elasticsearch
port 9200
index_name logs
include_timestamp true
user elastic
password Passw0rd
</match>

View File

@ -1,16 +0,0 @@
version: "3"
services:
db:
image: postgres:16
ports:
- "5432:5432"
environment:
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "password"
POSTGRES_DB: "hideout"
mongodb:
image: mongo:7.0.14
ports:
- "27017:27017"

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<configuration> <configuration>
<property name="LOG_FILE" value="logs/logFile.log"/> <property name="LOG_FILE" value="logs/logFile.log"/>
<property name="CONSOLE_LOG_THRESHOLD" value="${CONSOLE_LOG_THRESHOLD:-INFO}"/> <property name="CONSOLE_LOG_THRESHOLD" value="${CONSOLE_LOG_THRESHOLD:-TRACE}"/>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/> <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/> <include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
<include resource="org/springframework/boot/logging/logback/file-appender.xml"/> <include resource="org/springframework/boot/logging/logback/file-appender.xml"/>
@ -12,4 +12,8 @@
<appender-ref ref="ECS_JSON_FILE"/> <appender-ref ref="ECS_JSON_FILE"/>
<appender-ref ref="FILE"/> <appender-ref ref="FILE"/>
</root> </root>
<logger name="javax.management" level="INFO"/>
<logger name="sun.rmi.loader" level="INFO"/>
<logger name="sun.rmi" level="INFO"/>
<logger name="java.io.serialization" level="INFO"/>
</configuration> </configuration>