mirror of
https://github.com/AudebertAdrien/ft_transcendence.git
synced 2025-12-16 05:57:48 +01:00
before thouch change
This commit is contained in:
parent
d149bb1f61
commit
790c6c276d
@ -15,4 +15,4 @@ RUN python3 -m venv venv
|
||||
RUN venv/bin/pip3 install --upgrade pip
|
||||
RUN venv/bin/pip3 install --no-cache-dir -r requirements.txt
|
||||
|
||||
EXPOSE 80
|
||||
EXPOSE 8080
|
||||
|
||||
@ -1,21 +1,24 @@
|
||||
input {
|
||||
udp {
|
||||
host => "0.0.0.0"
|
||||
port => 5044
|
||||
file {
|
||||
path => "/transcendence/django.log" # Adjust this path to where the log file is stored
|
||||
start_position => "beginning"
|
||||
sincedb_path => "/dev/null"
|
||||
codec => "json"
|
||||
}
|
||||
}
|
||||
|
||||
filter {}
|
||||
filter {
|
||||
}
|
||||
|
||||
output {
|
||||
elasticsearch {
|
||||
index => "logstash-%{+YYYY.MM.dd}"
|
||||
hosts => ["https://es01:9200"]
|
||||
user => "elastic"
|
||||
password => elastic_pass
|
||||
ssl_enabled => true
|
||||
password => "${ELASTIC_PASSWORD}"
|
||||
ssl_enabled => true
|
||||
ssl_certificate_authorities => "/usr/share/logstash/certs/ca/ca.crt"
|
||||
ssl_verification_mode => "full"
|
||||
index => "django-logs-%{+YYYY.MM.dd}"
|
||||
}
|
||||
#stdout {}
|
||||
stdout { codec => rubydebug } # Optional: For debugging purposes
|
||||
}
|
||||
|
||||
@ -6,8 +6,9 @@ Django settings for pong project.
|
||||
Generated by 'django-admin startproject' using Django 3.2.
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
import os
|
||||
import logging.config
|
||||
from pathlib import Path
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
@ -134,3 +135,38 @@ CHANNEL_LAYERS = {
|
||||
'BACKEND': 'channels.layers.InMemoryChannelLayer',
|
||||
},
|
||||
}
|
||||
|
||||
LOGGING = {
|
||||
'version': 1, # The version of the logging configuration schema
|
||||
'disable_existing_loggers': False, # Allows existing loggers to keep logging
|
||||
'formatters': { # Defines how log messages will be formatted
|
||||
'json': {
|
||||
'()': 'pythonjsonlogger.jsonlogger.JsonFormatter',
|
||||
# Formatter that outputs logs in JSON format, which is ideal for ingestion by Logstash.
|
||||
},
|
||||
'default': {
|
||||
'format': '[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s',
|
||||
# This is a basic text formatter with timestamp, log level, logger name, line number, and the actual message.
|
||||
},
|
||||
},
|
||||
'handlers': { # Handlers determine where the log messages are sent
|
||||
'file': {
|
||||
'level': 'INFO', # Minimum log level to be handled (INFO and above)
|
||||
'class': 'logging.FileHandler',
|
||||
'filename': os.path.join(BASE_DIR, 'django.log'), # The file where logs will be saved
|
||||
'formatter': 'json', # Uses the JSON formatter defined above
|
||||
},
|
||||
'console': {
|
||||
'level': 'DEBUG', # Minimum log level to be handled (DEBUG and above)
|
||||
'class': 'logging.StreamHandler',
|
||||
'formatter': 'default', # Uses the default text formatter
|
||||
},
|
||||
},
|
||||
'loggers': { # Loggers are the actual log streams that get configured
|
||||
'django': { # The Django logger catches all messages sent by the Django framework
|
||||
'handlers': ['file', 'console'], # Sends logs to both the file and the console
|
||||
'level': 'DEBUG', # Minimum log level to be logged
|
||||
'propagate': True, # If True, messages will be passed to the parent loggers as well
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -5,3 +5,4 @@ channels
|
||||
daphne
|
||||
djangorestframework
|
||||
web3
|
||||
python-json-logger==2.0.7
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user