xavier-hernandez / goaccess-for-nginxproxymanager

GoAccess Docker Image for Nginx Proxy Manager and more...
https://hub.docker.com/r/xavierh/goaccess-for-nginxproxymanager
MIT License
532 stars 39 forks source link

NPM with GeoLite2 not working #137

Closed MyKeySoftMK closed 1 year ago

MyKeySoftMK commented 1 year ago

Hello, I am new on GoAccess. I need it for control my geoblocking with NPM.

I have installed NPM like here https://www.reddit.com/r/nginxproxymanager/comments/sjf1hw/tutorial_nginx_proxy_manager_together_with_geoip2/

The log is

log_format proxy_geo escape=json '[$time_local] [Client $remote_addr] [$allowed_country $geoip2_data_country_code $geoip2_data_country_name $geoip2_data_region_name $geoip2_data_city_name] "$http_user_agent" '
                             '$upstream_cache_status $upstream_status $status - $request_method $scheme $host "$request_uri" [Length $body_bytes_sent] [Gzip $gzip_ratio] [Sent-to $server] "$http_referer"';

In NPM I have following logs:

108 -rw-r--r-- 1 root root 105663 Mär  6 08:50 proxy-host-1_access-geo.log
728 -rw-r--r-- 1 root root 741086 Mär  6 08:50 proxy-host-1_access.log
  4 -rw-r--r-- 1 root root    630 Mär  6 07:31 proxy-host-1_error.log
 12 -rw-r--r-- 1 root root  11002 Mär  6 08:28 proxy-host-2_access.log
  8 -rw-r--r-- 1 root root   6169 Mär  6 08:28 proxy-host-2_error.log
  0 -rw-r--r-- 1 root root      0 Jan 22 10:16 proxy-host-3_access.log
  0 -rw-r--r-- 1 root root      0 Jan 22 10:16 proxy-host-3_error.log

I have installed your docker - but the log say following:

==26== FILE: /opt/log/proxy-host-1_access-geo.log
==26== Parsed 10 lines producing the following errors:
==26==
==26== Token '[yes' doesn't match specifier '%s'
==26== Token '[yes' doesn't match specifier '%s'
==26== Token '[yes' doesn't match specifier '%s'
==26== Token '[yes' doesn't match specifier '%s'
==26== Token '[yes' doesn't match specifier '%s'
==26== Token '[yes' doesn't match specifier '%s'
==26== Token '[yes' doesn't match specifier '%s'
==26== Token '[yes' doesn't match specifier '%s'
==26== Token '[yes' doesn't match specifier '%s'
==26== Token '[yes' doesn't match specifier '%s'
==26==
==26== Format Errors - Verify your log/date/time format

How can I use it?

proxy-host-1_access-geo.log proxy-host-1_access.log

xavier-hernandez commented 1 year ago

Thanks for the information. I'll take a look at it.

MyKeySoftMK commented 1 year ago

Here my Solution - now it works

docker-compose.yml

version: '3.3'
services:
    goaccess:
        image: 'xavierh/goaccess-for-nginxproxymanager:latest'
        container_name: goaccess
        restart: always
        ports:
            - '7890:7890'
        environment:
            - TZ=Europe/Berlin
            - SKIP_ARCHIVED_LOGS=False #optional
            - DEBUG=False #optional
            - BASIC_AUTH=False #optional
            - BASIC_AUTH_USERNAME=user #optional
            - BASIC_AUTH_PASSWORD=pass #optional
            - EXCLUDE_IPS=127.0.0.1 #optional - comma delimited
            - LOG_TYPE=CUSTOM #optional - more information below
        volumes:
        - ~/npm/data/logs:/opt/log
        - ./custom:/opt/custom #optional, required if using log_type = CUSTOM

custom/goaccess.conf

real-time-html true
log-file /opt/log/proxy-host-1_access-geo.log
output /var/www/html/index.html

date-format %d/%b/%Y
time-format %T
log-format [%d:%t %^] [%^ %h] [%^ %e] "%u"  %^ %s %^ %m %^ %v "%U" [%^ %b] [%^] [%^] [%^] "%R"