diff --git a/config.example.yml b/config.example.yml index 9c99d9a..5666259 100644 --- a/config.example.yml +++ b/config.example.yml @@ -30,6 +30,41 @@ entrypoint: status: 403 message: "Forbidden" - use: RedirectHTTP + # access_log: + # buffer_size: 1024 + # path: /var/log/example.log + # filters: + # status_codes: + # values: + # - 200-299 + # - 101 + # method: + # values: + # - GET + # host: + # values: + # - example.y.z + # headers: + # negative: true + # values: + # - foo=bar + # - baz + # cidr: + # values: + # - 192.168.10.0/24 + # fields: + # headers: + # default: keep + # config: + # foo: redact + # query: + # default: drop + # config: + # foo: keep + # cookies: + # default: redact + # config: + # foo: keep providers: # include files are standalone yaml files under `config/` directory diff --git a/next-release.md b/next-release.md index fa9355f..7420fb2 100644 --- a/next-release.md +++ b/next-release.md @@ -201,6 +201,8 @@ - **New:** Access Logging (entrypoint and per route), i.e. + **mount logs directory before setting this** + ```yaml # config.yml entrypoint: @@ -245,7 +247,64 @@ - 10.0.0.0/16 ``` - **mount logs directory before setting this** + To integrate with **goaccess**, currently need to use **caddy** as a file web server. Below should work with `combined` log format. + + ```yaml + # compose.yml + services: + app: + image: reg.6uo.me/yusing/goproxy + ... + volumes: + ... + - ./logs:/app/logs + caddy: + image: caddy + restart: always + labels: + proxy.goaccess.port: 80 + proxy.goaccess.middlewares.request.set_headers.host: goaccess + volumes: + - ./Caddyfile:/etc/caddy/Caddyfile:ro + - ./logs:/var/www/goaccess:ro + depends_on: + - goaccess + goaccess: + image: hectorm/goaccess:latest + restart: always + volumes: + - ./logs:/srv/logs + command: > # for combined format + /srv/logs/access.log + -o /srv/logs/report.html + -j 4 # 4 threads + --real-time-html + --ws-url=:443 # i.e. goaccess.my.app:443/ws + --log-format='%v %h %^[%d:%t %^] "%r" %s %b "%R" "%u"' + ``` + + Caddyfile + + ```caddyfile + { + auto_https off + } + + goaccess:80 { + @websockets { + header Connection *Upgrade + header Upgrade websocket + } + + handle @websockets { + reverse_proxy goaccess:7890 + } + + root * /var/www/goaccess + file_server + rewrite / /report.html + } + ``` ## Fixes @@ -255,4 +314,6 @@ - various other small bugs - `realIP` and `cloudflareRealIP` middlewares - prometheus metrics gone after a single route reload +- WebUI app links now works when `match_domains` is not set +- WebUI config editor now display validation errors properly - upgraded dependencies to the latest diff --git a/schema/config.schema.json b/schema/config.schema.json index 4ffebb4..2a4a9d2 100644 --- a/schema/config.schema.json +++ b/schema/config.schema.json @@ -445,6 +445,158 @@ } } } + }, + "access_log": { + "title": "Access log configuration", + "type": "object", + "additionalProperties": false, + "properties": { + "path": { + "title": "Access log path", + "type": "string" + }, + "format": { + "title": "Access log format", + "type": "string", + "enum": [ + "common", + "combined", + "json" + ] + }, + "buffer_size": { + "title": "Access log buffer size in bytes", + "type": "integer", + "minimum": 1 + }, + "filters": { + "title": "Access log filters", + "type": "object", + "additionalProperties": false, + "properties": { + "cidr": { + "title": "CIDR filter", + "type": "object", + "additionalProperties": false, + "properties": { + "negative": { + "type": "boolean" + }, + "values": { + "type": "array" + } + } + }, + "status_codes": { + "title": "Status code filter", + "type": "object", + "additionalProperties": false, + "properties": { + "negative": { + "type": "boolean" + }, + "values": { + "type": "array" + } + } + }, + "method": { + "title": "Method filter", + "type": "object", + "additionalProperties": false, + "properties": { + "negative": { + "type": "boolean" + }, + "values": { + "type": "array" + } + } + }, + "headers": { + "title": "Header filter", + "type": "object", + "additionalProperties": false, + "properties": { + "negative": { + "type": "boolean" + }, + "values": { + "type": "array" + } + } + }, + "host": { + "title": "Host filter", + "type": "object", + "additionalProperties": false, + "properties": { + "negative": { + "type": "boolean" + }, + "values": { + "type": "array" + } + } + } + } + }, + "fields": { + "title": "Access log fields", + "type": "object", + "additionalProperties": false, + "properties": { + "headers": { + "type": "object", + "additionalProperties": false, + "properties": { + "default": { + "enum": [ + "keep", + "redact", + "drop" + ] + }, + "config": { + "type": "object" + } + } + }, + "query": { + "type": "object", + "additionalProperties": false, + "properties": { + "default": { + "enum": [ + "keep", + "redact", + "drop" + ] + }, + "config": { + "type": "object" + } + } + }, + "cookies": { + "type": "object", + "additionalProperties": false, + "properties": { + "default": { + "enum": [ + "keep", + "redact", + "drop" + ] + }, + "config": { + "type": "object" + } + } + } + } + } + } } } },