From 243488128ccbdcf37466defeb173857d79484f11 Mon Sep 17 00:00:00 2001 From: nadeemshahzad Date: Tue, 8 Oct 2024 15:08:11 +0500 Subject: [PATCH] feat: Update Gunicorn Logging Configuration for Datadog Compatibility --- notesserver/docker_gunicorn_configuration.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/notesserver/docker_gunicorn_configuration.py b/notesserver/docker_gunicorn_configuration.py index fb612f73..ff2c418d 100644 --- a/notesserver/docker_gunicorn_configuration.py +++ b/notesserver/docker_gunicorn_configuration.py @@ -9,6 +9,17 @@ workers = 2 +# Set the log level for Gunicorn +loglevel = 'info' + +# Set access and error logs to std +accesslog = '-' # Access logs to stdout +errorlog = '-' # Error logs to stdout + +# Define the custom access log format to match the Datadog pipeline format +access_log_format = '%(t)s %(l)s [%(r)s] [%(p)s] [dd.trace_id=%(o)s dd.span_id=%(O)s] "%(m)s %(U)s %(H)s" %(s)s %(b)s "%(f)s" "%(a)s"' + + def pre_request(worker, req): worker.log.info("%s %s" % (req.method, req.path))