Using GoAccess

A fast web log analyzer and interactive viewer.

Dec. 16, 2020, 9 a.m.

UPDATE: I recently changed from a crontab to using the websocket and it works great. This post was extremely useful when setting up the websocket. (also some nginx info around the web)

goaccess /var/log/nginx/access.log -o /var/www/report.html --log-format=COMBINED --real-time-html --ws-url=wss://domain:443/ws --port 7890 --daemon


This year I built a middleware for Django to store data on visitors to websites. It would store things like the page they view, the site that referred them, and their IP address/country. This worked fine for the longest time, but it's very redundant since I already have this information in my Nginx (HTTP server) logs and it was stored in my database for my website. I still have one model (table) that I store just to keep a copy of it in case I delete the logs from Nginx.

Before you start getting paranoid just know, an IP address isn't private and all websites that you access usually have logs enabled to help debug issues to seeing when a bad guy tries to access things. Just to put your mind at ease I don't give out any of my data and nor will I ever.



I started building out a dashboard that was going to be like GoAccess - that was until I found GoAccess. My version was going to be such shit compared to GoAccess.

Installing GoAccess is very simple. They have packages that you can fetch and their getting started page is very simple to follow, they even have a manpage.

The way that I'm using GoAccess is via a cron instead of their WebSocket server. This probably isn't the best way, but it's the method that works for me.

*/10 * * * * goaccess /var/log/nginx/access.log -o /var/www/report.html --log-format=COMBINED

One thing I really can't wait for is the filtering option. This feature will completely change everything.



until next time