I’m trying to setup GoAccess for real time web log analyzing. Unfortunately, the documentation isn’t very helpful (at least for me, that is).
I’ve got GoAccess up and running and can look at real life data in a terminal, but setting up a HTML page is beyond my understanding. I’m running GoAccess with goaccess /var/log/caddy/access.log --real-time-html -o /var/www/report/report.html -p /etc/goaccess/goaccess.conf. In my Caddyfile I’ve set up www.mydomain.com/report as a site, and the first look at report.html with a browser populates the page with a nice visualization of the data from my Caddy logs.
So far, so good, but the difficulty is that I can’t find out how to make this static page to a real life one. GoAccess sets up a websocket server on port 7890 to deliver the data stream from the logs, and here is the point where I don’t know how to proceed. I tried various variations with the proxy directive, but nothing worked so far.
Has someone got GoAccess working with Caddy? Here is an example with a nginx configuration, but I can’t translate this into a Caddyfile.
Should I have a different *.log file for each site (and therefore have multiple log-file /path/to/access.log) or can I make each site pointing to the same *.log file?
Ok, I solved it: it seems that if you use the HTML layout you have to use an existing webserver. In my case I have one on port 82, so just I configured Caddy to that port and it works:
The index.html file is generated once at GoAccess startup and stays the same after that point. For live updating, the site connects you to a websocket which supplies the new information. If the websocket isn’t enabled or can’t connect, you’ll only ever get first-run data.
I checked and I receive the following error on the Google Chrome Dev Tool:
WebSocket connection to 'wss://sub.domain.com:7890/' failed: Establishing a tunnel via proxy server failed.
setWebSocket @ (index):28
initialize @ (index):28
window.onload @ (index):28
The problem could be originated by the fact that Caddy is set to look at http://192.168.10.37:82/goaccess/index.html (which is the port where my Apache Server is running, i.e. the sole location that I managed to make it accessible for reading the index.html file).
An externally-accessible reverse proxy to the GoAccess websocket
To have GoAccess point your browser at that externally-accessible URI
Caddy can handle the former quite easily (looks like you’re already doing this in your latest Caddyfile). The latter you’ll need to look into GoAccess’ own configuration options.
In practice you are saying to point the reverse proxy to port 7890 and to just look at the goaccess config file to find a directory which is accessible by the websocket to put the index.html, right?
Not 100% sure I understand what you mean by that, sorry.
The index file and websocket are handled very separately. One is a file served from the disk, the other is an upstream server you can reverse proxy to.
You need to configure GoAccess to announce the correct URI through which an external client can reach the websocket. Currently it’s announcing port 7890, which isn’t working.