allinurl / goaccess

GoAccess is a real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems or through your browser.
https://goaccess.io
MIT License
18.6k stars 1.11k forks source link

Real time html report should work without websockets? #1033

Open ghost opened 6 years ago

ghost commented 6 years ago

I run goaccess on an ubuntu/apache server. Apache serves some static content over https only.

Goaccess is started by a systemd service and running in daemon mode:

root@ydownload01:/var/www/html# ps -ef | grep -i goacc
root     13291     1 11 14:48 ?        00:00:00 /usr/bin/goaccess --config-file=/etc/goaccess.conf

In goaccess.conf I have:

Now my websockets don't work because of an ssl handshake error. I can live without this functionality because it is okay for me to just press F5 in my webbrowser.

But why doesn't the report get updated when I press F5?

allinurl commented 6 years ago

GoAccess uses a WebSocket connection to get the data from the server real-time. Refreshing the page won't change anything unless you are generating a new static report every X seconds/minutes.

BTW, what SSL error are you getting? You should be able to run goaccess without a wss connection, just don't pass any of the --ssl-* options.

ghost commented 6 years ago

Ah, that explains! Wrong assumption at my side :-) I have now created an hourly cronjob, that will work out for me.

However the use of websockets looks cool and would be nice to have. Unfortunately I cannot run the apache webserver that serves the report.html on http and when I tried to have the websockets on http my browser refused to mix the secure and non-secure content on the same page.

The ssl error I get is a failed ssl handshake, it was visible in the webbrowser console. It looked like it was a sslv3 which was not accepted by the browser. Unfortunately I don't know how to validate which ciphers/protocol versions are provided by the websocket server.

allinurl commented 6 years ago

Unfortunately I cannot run the apache webserver that serves the report.html on http and when I tried to have the websockets on http my browser refused to mix the secure and non-secure content on the same page.

You are right, it won't let you serve mix content. I'm curious to know what output do you get by building goaccess with --enable-debug and then running goaccess straight from the command line and accessing the report from your browser. Thanks.

artfulrobot commented 5 years ago

In case this is useful, here's how I got websockets working.

localmachine:$ SSH you@yourserver.com -L7890:localhost:7890
yourserver:$ goaccess -g access-live.log -q -o ~/goaccess.html --real-time-html --log-format=COMBINED

Now leave that terminal as-is and in a 2nd terminal,

localmachine:$ scp you@yourserver.com:goaccess.html ./

Then simply open that goaccess.html file in your browser. The browser then goes to localhost:7890 for an insecure websocket, but the traffic is tunneled by your SSH to the server where goaccess is running. So now you have:

allinurl commented 5 years ago

@artfulrobot thanks for sharing that!