Using GoAccess with Nginx Proxy Manager (NPM) to visuallize logs.¶
I mainly wanted to make sure and get this docker-compose.yml
in here for future use.
Note the last couple of lines. You can set to the log file to digest all logs. However, GoAccess doesn't support any filtering per hostname, so if you want to see analytics for only a particular host name, you want would to just mount the proxy-host-1_access.log
for example. npm creates one of these for each proxy host.
services:
nginx_proxy_manager:
image: "jc21/nginx-proxy-manager:latest"
container_name: nginx_proxy_manager
restart: unless-stopped
network_mode: "host"
ports:
- "80:80" # HTTP
- "443:443" # HTTPS
- "81:81" # Admin Panel
volumes:
- ./data/npm_data:/data
- ./data/npm_letsencrypt:/etc/letsencrypt
- ./data/npm_logs:/var/log/nginx
environment:
DB_SQLITE_FILE: "/data/database.sqlite" # Using SQLite instead of MySQL for simplicity
INITIAL_ADMIN_EMAIL: admin@example.com
INITIAL_ADMIN_PASSWORD: changeme
goaccess:
image: justsky/goaccess-for-nginxproxymanager:latest
container_name: goaccess
restart: unless-stopped
environment:
- TZ=America/Denver
#- SKIP_ARCHIVED_LOGS=False #optional
#- BASIC_AUTH=False #optional
#- BASIC_AUTH_USERNAME=user #optional
#- BASIC_AUTH_PASSWORD=pass #optional
ports:
- '7880:7880'
volumes:
#- ./data/npm_data/logs:/opt/log
- ./data/npm_data/logs/proxy-host-1_access.log:/opt/log/proxy-host-1_access.log
Note when using a cloud flare tunnel, make sure you add this in the advanced tab. This will ensure you're getting the real ip from users from the cloudflare tunnel.