Requirement
GoAccess has the ability the output real-time data in the HTML report. You can even email the HTML file since it is composed of a single file with no external file dependencies, how neat is that!
The process of generating a real-time HTML report is very similar to the process of creating a static report. Only --real-time-html is needed to make it real-time.
Pre-Requisites
- NGINX web server which support websocket
- Install goaccess on the same server
Step 01: Configure NGINX proxy pass for goaccess real-time push
location /ws-goaccess {proxy_pass http://127.0.0.1:9870;proxy_http_version 1.1;proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection "upgrade";}
In my case Go-Access websocket port listen locally with port 9870.
Step 02: Identify log format of your NGINX web server
I used this GitHum repository to find out log format for goaccess.
URL: https://github.com/stockrt/nginx2goaccess
Command Usage
Usage: ./nginx2goaccess.sh '<log_format>'
NGINX log format u have to get from your web server. It should be in nginx.conf file. Configuration parameter "log_format"
Step 03: Start the Go-Access WebSocket Server
goaccess /var/log/nginx/data.vidutech.org-access.log /var/log/nginx/www.vidutech.org-access.log --log-format='%h - %^ [%d:%t %^] "%r" "%b" "%R" "%u" "%^"' --date-format=%d/%b/%Y --time-format=%T -o /usr/share/nginx/html/goaccess.html --real-time-html --addr=127.0.0.1 --port=9870 --ws-url=data.vidutech.org/ws-goaccess
Command Explanation
We can pass several log files as input
- /var/log/nginx/data.vidutech.org-access.log
- /var/log/nginx/www.vidutech.org-access.log
- You can obtain it from Step 02
- Go-Access report should be save under nginx share location. This file should be accessible via browser with server name.
- Start server as real-time
- Listen address and port





No comments:
Post a Comment