🏗️」 wip: logstash workinnnggg

This commit is contained in:
2025-07-26 10:31:26 +02:00
parent 8982e72969
commit f1d54de6a5
19 changed files with 95 additions and 1 deletions

4
docker/ELK/compose.yml Normal file
View File

@ -0,0 +1,4 @@
include:
- ./logstash/compose.yml
# - ./kibana/compose.yml
# - ./elasticsearch/compose.yml

View File

@ -0,0 +1,3 @@
FROM docker.elastic.co/elasticsearch/elasticsearch-wolfi:9.0.3
COPY --chown=elasticsearch:elasticsearch elasticsearch.yml /usr/share/elasticsearch/config/

View File

@ -0,0 +1,10 @@
services:
elasticsearch:
container_name: transcendence-elasticsearch
build:
dockerfile: Dockerfile
context: .
environment:
- LOG_LEVEL=info
- ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
mem_limit: 1gb

View File

@ -0,0 +1 @@
FROM kibana:9.0.3

View File

View File

@ -0,0 +1,6 @@
FROM docker.elastic.co/logstash/logstash-wolfi:9.0.3
RUN rm -f /usr/share/logstash/pipeline/logstash.conf
COPY --chmod=777 pipeline/ /usr/share/logstash/pipeline/
COPY --chmod=777 config/ /usr/share/logstash/config/

View File

@ -0,0 +1,14 @@
services:
logstash:
container_name: transcendence-logstash
build:
dockerfile: Dockerfile
context: .
volumes:
- log-user:/var/log/user-api
- log-auth:/var/log/auth-api
- log-nginx:/var/log/nginx
environment:
- LOG_LEVEL=info
networks:
- elk

View File

@ -0,0 +1,2 @@
api:
environment: production

View File

@ -0,0 +1,27 @@
input {
file {
path => "/var/log/user-api/log.log"
start_position => "beginning"
tags => [ "api", "user" ]
}
file {
path => "/var/log/auth-api/log.log"
start_position => "beginning"
tags => [ "api", "auth" ]
}
file {
path => "/var/log/nginx/log.log"
start_position => "beginning"
tags => [ "nginx", "front" ]
}
file {
path => "/var/log/nginx/err.log"
start_position => "beginning"
tags => [ "nginx", "front", "error" ]
}
}
output {
elasticsearch { hosts => ["transcendence-elasticsearch:9200"] }
stdout { codec => rubydebug }
}

View File

@ -24,5 +24,7 @@ EXPOSE 3000
RUN mkdir /db
STOPSIGNAL SIGINT
ENV LOG_TARGET=/var/log/log.log
RUN touch /var/log/log.log
CMD [ "node", "/app/src/start.js" ]

View File

@ -6,6 +6,7 @@ services:
context: ../../
volumes:
- db-user:/db
- log-user:/var/log
networks:
- front
- back
@ -22,6 +23,7 @@ services:
context: ../../
volumes:
- db-auth:/db
- log-auth:/var/log
networks:
- front
- back

View File

@ -6,3 +6,4 @@ include:
- ./monitoring/compose.yml
- ./api-base/compose.yml
- ./front/compose.yml
- ./ELK/compose.yml

View File

@ -25,5 +25,13 @@ COPY --chmod=755 docker/front/entry/ssl-cert.sh /docker-entrypoint.d/ssl-cert.s
COPY --from=builder /app/dist /usr/share/nginx/html
USER root
RUN mkdir -p /var/log/front
RUN touch /var/log/front/err.log /var/log/front/log.log
RUN chmod -R 777 /var/log/front
USER nginx
EXPOSE 80 443
STOPSIGNAL SIGINT

View File

@ -6,6 +6,8 @@ services:
context: ../../
ports:
- ${OUT_PORT}:443
volumes:
- log-nginx:/var/log/front
environment:
- SERVER_NAME=localhost
- TZ=Europe/Paris

View File

@ -1,4 +1,7 @@
server {
error_log /var/log/front/err.log warn;
access_log /var/log/front/log.log;
listen 443 ssl;
server_name example.com; # Replace with your domain or handle env vars externally

View File

@ -7,3 +7,5 @@ networks:
name: transcendence-prom
prom-exporter:
name: transcendence-prom-exporter
elk:
name: transcendence-elk

View File

@ -5,3 +5,9 @@ volumes:
name: transcendence-api-auth-db
db-user:
name: transcendence-api-user-db
log-auth:
name: transcendence-api-auth-log
log-user:
name: transcendence-api-user-log
log-nginx:
name: transcendence-front-log

View File

@ -10,7 +10,8 @@ const loggerOption = {
translateTime: 'HH:MM:ss',
ignore: 'pid,hostname'
}
}
},
file: process.env.LOG_TARGET || ""
};
function sigHandle(signal) {