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

@@ -19,4 +19,4 @@ data:
LOGOUT_REDIRECT_URL: "login" LOGOUT_REDIRECT_URL: "login"
TRUSTED_PROXIES: "192.168.17.44,192.168.17.53" TRUSTED_PROXIES: "192.168.17.44,192.168.17.53"
GUNICORN_OPTS: "--access-logfile -" GUNICORN_OPTS: "--access-logfile -"
IMAGE_TAG: "0.072" IMAGE_TAG: "0.073"

View File

@@ -27,7 +27,7 @@ spec:
mountPath: /data mountPath: /data
containers: containers:
- name: web - name: web
image: git.baumann.gr/adebaumann/labhelper:0.072 image: git.baumann.gr/adebaumann/labhelper:0.073
imagePullPolicy: Always imagePullPolicy: Always
ports: ports:
- containerPort: 8000 - containerPort: 8000

View File

@@ -24,6 +24,14 @@ class CustomLogger(Logger):
def atoms(self, resp, req, environ, request_time): def atoms(self, resp, req, environ, request_time):
atoms = super().atoms(resp, req, environ, request_time) atoms = super().atoms(resp, req, environ, request_time)
atoms["{client-ip}e"] = self._get_client_ip(environ) 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 return atoms
@staticmethod @staticmethod
@@ -42,4 +50,4 @@ class CustomLogger(Logger):
logger_class = CustomLogger 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]'