==================================================================================== === Установка: ==================================================================================== wget -O - https://deb.goaccess.io/gnugpg.key | gpg --dearmor | tee /usr/share/keyrings/goaccess.gpg >/dev/null echo "deb [signed-by=/usr/share/keyrings/goaccess.gpg arch=$(dpkg --print-architecture)] https://deb.goaccess.io/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/goaccess.list apt-get update apt-get install goaccess ==================================================================================== === Разное из настройки goaccess: ==================================================================================== ssh user@server "cat /var/log/project/project_acc.log" | goaccess --log-format=COMBINED - ssh user@server "awk '$9~/500/' /var/log/project/project_acc.log" | goaccess - SERVER_NAME HTTP_CODE CREDENTIALS PORT ssh user@server 'awk "\$9~/200/" /var/log/project/project_acc.log' | goaccess --log-format=COMBINED - -o ~/temp/report.html ssh user@server 'awk "\$9~/403/" /var/log/project/project_acc.log' | goaccess --log-format=COMBINED - -o ~/temp/report.html ssh user@server 'awk "\$9~/404/" /var/log/project/project_acc.log' | goaccess --log-format=COMBINED - -o ~/temp/report.html ssh user@server 'sed -n '/15\/Apr\/2019\:06\:00/,/15\/Apr\/2019\:06\:05/ p' /home/user/access.log.2' | goaccess --log-format=COMBINED - -o ~/temp/report.html sed -n '/15\/Apr\/2019\:06\:00/,/15\/Apr\/2019\:06\:05/ p' access.log.2 ssh user@server "sed -n '/15\/Apr\/2019\:06\:00/,/15\/Apr\/2019\:06\:05/ p' /home/user/access.log.2" | goaccess --log-format=COMBINED - -o ~/temp/report.html ########################################################## %h ["%^", "%^"] - %^ [%d:%t %^] "%r" %s %b "%R" "%u" %T %d/%m/%Y %H:%M:%S 1.1.1.1 ["Country", "City"] - - [29/Apr/2020:14:33:24 +0300] "GET /favicon.ico HTTP/2.0" 404 146 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0" "-" --log-format='%h ["%^", "%^"] - %^ [%d:%t %^] "%r" %s %b "%R" "%u" %T' --time-format='%H:%M:%S' --date-format='%d/%b/%Y' log-format='%h ["%^", "%^"] - %^ [%d:%t %^] "%r" %s %b "%R" "%u" %T' time-format='%H:%M:%S' date-format='%d/%b/%Y' ########################################################## Рабочий вариант (минимальный): # access_log configuration /etc/nginx/nginx.conf: log_format main_geo2 '$remote_addr - $remote_user [$time_local] "$request"'; sudo -u nginx /usr/bin/goaccess /var/log/nginx/access.log --log-format='%h - %^ [%d:%t %^] "%r"' --time-format='%T' --date-format='%d/%b/%Y' -o /var/www/nginx_report/s/report.html --geoip-database /etc/nginx/geoip/Geo Lite2-City.mmdb ########################################################################### Рабочий вариант (текущий): # access_log configuration /etc/nginx/nginx.conf: log_format main_geo2 '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for" $geoip2_data_country_iso_code $geoip2_data_country_name $geoip2_data_city_name'; sudo -u nginx /usr/bin/goaccess /var/log/nginx/access.log --log-format='%h - %^ [%d:%t %^] "%r" %s %b "%R" "%u" "%^" %^2_data_country_iso_code %^2_data_country_name %^2_data_city_name' --time-format='%T' --date-format='%d/%b/%Y' -o /var/www/nginx_report/s/report.html --geoip-database /etc/nginx/geoip/GeoLite2-City.mmdb ==================================================================================== === Чтение лога nginx с помощью goaccess (log-format должен соответствовать настройкам логирования самого nginx): ==================================================================================== # /usr/local/bin/goaccess /var/log/nginx/access.log --log-format='%h ["%^", "%^"] - %^ [%d:%t %^] "%r" %s %b "%R" "%u" %T' --time-format='%H:%M:%S' --date-format='%d/%b/%Y' -o ~/report.html --geoip-database /etc/nginx/geoip/geoip_city.dat