I鈥檓 hosting multiple websites on one VPS. I鈥檇 like to use GoAccess to offer stats on all of the websites, individually, and just run the daemons pretty much 24/7. I figured to start out I鈥檇 just run two at a time, to make sure it works.
So as of right now I鈥檝e got two GoAccess processes going at once. Here is the command I used:
[root@localhost ~]# goaccess /var/log/httpd/main.site-access.log* --log-format=COMBINED --real-time-html --daemonize --port=7890 --ssl-cert=/etc/letsencrypt/live/www.main.site/fullchain.pem --ssl-key=/etc/letsencrypt/live/www.main.site/privkey.pem -o /var/www/mainsite/main.site/panels/main.site-stats.html
[root@localhost ~]# goaccess /var/log/httpd/secondary-access.log* --log-format=COMBINED --real-time-html --daemonize --port=7891 --ssl-cert=/etc/letsencrypt/live/www.main.site/fullchain.pem --ssl-key=/etc/letsencrypt/live/www.main.site/privkey.pem -o /var/www/mainsite/main.site/panels/secondary.site-stats.html
Netstat says it鈥檚 working as planned:
[root@localhost ~]# netstat -tlpn | grep goaccess
tcp 0 0 0.0.0.0:7890 0.0.0.0:* LISTEN 306026/goaccess
tcp 0 0 0.0.0.0:7891 0.0.0.0:* LISTEN 306002/goaccess
They've been running for about 24 hours now. Everything looks and works fine when you open one html page: the page updates real-time, it's showing stats for the correct website, etc, etc. But it starts to behave strangely if someone is looking at both at the same time.
If someone has a GoAccess output page open in their web browser, and a second GoAccess output page gets opened by someone else, one of three things happens (seemingly at random):
Also to note: if someone visits one of the websites while both browsers are open, and the logs get updated, then one of the open html pages will update correctly (apparently at random) and the other will behave as per 1, 2 and 3 above (also apparently at random). So if someone visits secondary.site, sometimes the output page for main.site will switch to secondary.site while the output page for secondary.site might go haywire and combine both stats, or else stay static and not update at all.
I have tried this with different machines / different IP addresses accessing both html output pages, and with a third machine / IP address visiting the website (to trigger an access log update).
So is this a bug? Or have I set it up incorrectly?
Or am I just asking GoAccess to do something it's not built for?
Thanks for bringing this up and the detailed explanation. Seems like you are using the same named pipe. Please take a look at this post for details on running multiple instances.
Let me know if that fixes the issue for you.
That did the trick! I was prepared to just do a once-per-minute cron job to update static html pages, but this is far more satisfying.
Thanks for the great application, and for the great support!
Glad that worked :)