GoAccess: combine host and path in reports
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
FROM allinurl/goaccess:1.10.2
|
||||
|
||||
RUN apk add --no-cache jq
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod 0755 /usr/local/bin/entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
@@ -1,22 +1,23 @@
|
||||
services:
|
||||
|
||||
goaccess_processor:
|
||||
image: allinurl/goaccess:1.10.2
|
||||
build: .
|
||||
image: local/goaccess-jq:1.10.2
|
||||
container_name: goaccess_processor
|
||||
restart: unless-stopped
|
||||
init: true
|
||||
user: "{{ app_owner_uid }}:{{ app_owner_gid }}"
|
||||
command: >
|
||||
--log-format=CADDY
|
||||
--enable-panel=VIRTUAL_HOSTS
|
||||
--real-time-html
|
||||
--port=7890
|
||||
--ws-url=wss://goaccess.vakhrushev.me:443
|
||||
--output=/srv/report/index.html
|
||||
--persist
|
||||
--restore
|
||||
--db-path=/srv/db
|
||||
--no-global-config
|
||||
/srv/logs/access.log
|
||||
command:
|
||||
- --log-format=COMBINED
|
||||
- --enable-panel=VIRTUAL_HOSTS
|
||||
- --real-time-html
|
||||
- --port=7890
|
||||
- --ws-url=wss://goaccess.vakhrushev.me:443
|
||||
- --output=/srv/report/index.html
|
||||
- --persist
|
||||
- --restore
|
||||
- --db-path=/srv/db
|
||||
- --no-global-config
|
||||
volumes:
|
||||
- "{{ caddy_logs_dir }}:/srv/logs:ro"
|
||||
- "{{ db_dir }}:/srv/db"
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
# Tail Caddy's JSON access log, transform each entry into Apache CLF
|
||||
# Combined with the virtual host glued to the request URI, and feed
|
||||
# the stream straight into goaccess via stdin. Result: every line in
|
||||
# the Requests panel renders as `host.example.com/path`.
|
||||
|
||||
set -eu
|
||||
|
||||
ACCESS_LOG="/srv/logs/access.log"
|
||||
|
||||
JQ_FILTER='
|
||||
"\(.request.remote_ip // "-") - - " +
|
||||
"[\((.ts // 0) | gmtime | strftime("%d/%b/%Y:%H:%M:%S +0000"))] " +
|
||||
"\"\(.request.method) \(.request.host)\(.request.uri) \(.request.proto)\" " +
|
||||
"\(.status) \(.size) " +
|
||||
"\"\(.request.headers.Referer[0]? // "-")\" " +
|
||||
"\"\(.request.headers["User-Agent"][0]? // "-")\""
|
||||
'
|
||||
|
||||
tail -F -n +1 "$ACCESS_LOG" \
|
||||
| jq --unbuffered -rc "$JQ_FILTER" \
|
||||
| exec goaccess - "$@"
|
||||
Reference in New Issue
Block a user