Not logging correct IP yet
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/labhelper) (push) Successful in 28s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/labhelper-data-loader) (push) Successful in 7s

This commit is contained in:
2026-01-28 09:46:42 +01:00
parent 60e13822ee
commit 20239242ce
3 changed files with 11 additions and 3 deletions

View File

@@ -24,6 +24,14 @@ class CustomLogger(Logger):
def atoms(self, resp, req, environ, request_time):
atoms = super().atoms(resp, req, environ, request_time)
atoms["{client-ip}e"] = self._get_client_ip(environ)
headers = {
k[5:].replace("_", "-").lower(): v
for k, v in environ.items()
if k.startswith("HTTP_")
}
atoms["{all-headers}e"] = " | ".join(
f"{k}: {v}" for k, v in sorted(headers.items())
)
return atoms
@staticmethod
@@ -42,4 +50,4 @@ class CustomLogger(Logger):
logger_class = CustomLogger
access_log_format = '%({client-ip}e)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" xff:"%({x-forwarded-for}i)s" remote:%(h)s'
access_log_format = '%({client-ip}e)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" headers:[%({all-headers}e)s]'