From b4a38da20dd75022668c7812d66ecd7ec2ddae04 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 28 Jul 2026 14:19:49 -0300 Subject: [PATCH] feat: access logs --- .env.sample | 3 +++ abra.sh | 2 +- compose.access-log.yml | 9 +++++++++ traefik.yml.tmpl | 17 +++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 compose.access-log.yml diff --git a/.env.sample b/.env.sample index 9389641..6eb36bf 100644 --- a/.env.sample +++ b/.env.sample @@ -225,3 +225,6 @@ WRITE_TIMEOUT=0s ## Enable onion service support #ONION_ENABLED=1 + +## Keep access logs +#COMPOSE_FILE="$COMPOSE_FILE:compose.access-log.yml" diff --git a/abra.sh b/abra.sh index d5c01aa..202905e 100644 --- a/abra.sh +++ b/abra.sh @@ -1,3 +1,3 @@ -export TRAEFIK_YML_VERSION=v32 +export TRAEFIK_YML_VERSION=v33 export FILE_PROVIDER_YML_VERSION=v12 export ENTRYPOINT_VERSION=v5 diff --git a/compose.access-log.yml b/compose.access-log.yml new file mode 100644 index 0000000..90e5d59 --- /dev/null +++ b/compose.access-log.yml @@ -0,0 +1,9 @@ +--- +services: + app: + environment: + ACCESS_LOG_ENABLED: "true" + volumes: + - "access-logs:/var/log/" +volumes: + access-logs: diff --git a/traefik.yml.tmpl b/traefik.yml.tmpl index 28277b9..620d2c0 100644 --- a/traefik.yml.tmpl +++ b/traefik.yml.tmpl @@ -6,6 +6,23 @@ log: level: {{ env "LOG_LEVEL" }} maxAge: {{ env "LOG_MAX_AGE" }} +{{ if eq (env "ACCESS_LOG_ENABLED") "true" }} +accessLog: + format: "json" + filePath: "/var/log/access_log.jsonl" + filters: + retryAttempts: true + fields: + defaultMode: "keep" + headers: + defaultMode: "keep" + names: + Authorization: "drop" + Cookie: "drop" + queryParameters: + defaultMode: "keep" +{{ end }} + providers: swarm: endpoint: "tcp://socket-proxy:2375"