Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Websocket server configuration??? #1328
The documentation is frankly very bad regarding the real time configuration. What, exactly, does --ws-url configure?
There are two different things that we should be able to configure:
In addition, the server should support unix domain sockets.
--ws-url is where the websocket listens, --port is where the html page is served that opens the websocket. It took me many trials to get his all figured out but it does work once setup correctly. I have now used this in my gopanel web menu interface for multiple log files.
Here's an example how I start goaccess for web interface behind a nginx reverse proxy with ssl.
And in my.conf:
And nginx include file to do the ssl proxying (include in existing ssl site conf using port 443) :
Hopefully this sheds some light on actually running it. I know it looks more complicated but this is actually working and on any real site you're going to want ssl and admin auth anyway. You can use openssl to create .htpasswd file. Just google that. Anyway, at least you can mimic my options for a working setup.
You may find the websocket times out if you proxy it without the timeout values increased.
Ignore port 7880 and gopanel as that's where my web menu is served not the goaccess itself.
Thanks for the feedback, I'll look into expanding the documentation.
Just adding to the great info posted by @neocogent,
As indicated in the FAQ,
As far as
Can you please post how you are running goaccess and any relevant details about your environment and also the output of your browser's console. Thanks
Ideally, I would give the client an URL, consisting of a protocol, a host, a port and a resource. This can all be handled to the WebSocket constructor as is so nothing special needs to be actually done with the argument given in the command line, it can be used directly.
Ideally, I would give the server a tuple of a protocol and a location. The location can either be a port or a filesystem path. Supporting abstract paths is also possible and of course recommended, perhaps it could be marked with having a leading space in the name.
These should be passed as something like:
--ws-server-location "wss:// abstract"
Of course one could have mutually exclusive options or even separate options just for protocol and port and path and that's not actually a too bad of a idea, as long as they are documented clearly.
not sure if this fits in here, i'm trying to run goaccess with --real-time-html, first time it would produce a static page. I followed the guide in the README. so i came to the github repo, and found this issue, i tried following it, but now i'm getting a blank page when i try to access the webpage. I thought I'd try to figure it out modelling it after the notes in this issue thread, but with no luck.
and the pertinent part of my nginx.conf: (i'm just messing around locally, so no need for ssl yet)
and my command is
the websocket output in the terminal says:
Is there something I'm missing, or something in a guide somewhere that's more useful? i feel a little dumbfounded.
You don't need the first location section there. That is for my gopanel daemon. I should have removed it from above but was lazy. It listens on port 7880 and unless you are running it (in which case post on my gopanel github for help) it's not there.
The static page location is defined by the output-format line in the conf. It has to match the location that your nginx conf points to. I can't tell that from your conf. There needs to be some conf line that makes some page on your site load the file: /home/bucky/receipts/public/report.html
Here's how it works:
goaccess will start up and write the static report page, which should be served by nginx. When your browser loads that it uses the embedded ws-url value to open a websocket connection which nginx will proxy to port 7890, where goaccess will handle it.
If nginx is serving https for your site then use wss for the ws-url, otherwise ws should work (but I've not tested plain ws myself).
Hope this helps.
edit: actually there is a bit of trick in that first location section. The fact the location and proxy end with "/" cause only items after the url to be proxied and not the directory index itself. That gets handled by the base conf (that is including this one). That's not very obvious but it's why on my gopanel the static page gets served by nginx but the sub items get proxied to gopanel daemon. So this means for you something has to be added to make sure the static page gets served.