I’ve deployed my first live system with Phoenix and Elixir. Since this was a mostly manual process, I need a way to analyze the access logs generated by nginx.
Google Analytics works great for those clients that have JavaScript enabled. But what about uses who don’t? What about bots, cralwers, and requests to other files like CSS/JS?
Or what happens when there’s someone like me and doesn’t allow javascript by default or blocks certain domains?
We need another option!
Programming something in Elixir is certainly an option. But I don’t want to reinvent the wheel again.
AWstats is an option, however Virtualmin/Webmin requires you to configure it manually if you want it to work with nGINX.
Another solution is to use GoAccess. It provides a very simple interface and it has a realtime feature.
Goaccess + Phoenix
Most Linux distro’s have a older version 0.9.2. Version 1.2 allows for realtime HTML update by using websockets.
You can chose to recompile GoAccess or use the old version.
At this point you can implement a Controller View system to reload everything or allow port 7890 in the local firewall.
Real Time
goaccess -f ~/logs/access_log --log-format=COMBINED -o ~/goaccess_report.html --real-time-html
Simple generation
If you’re on a VPS like me and use a ton of security features, you might not want to enable the websockets feature nor allow another open port.
goaccess -f ~/logs/access_log --log-format=COMBINED -o ~/goaccess_report.html
Use Elixir PORT to run the program.
Using GoAccess for a few weeks
It’s funny to note that after using it for a few weeks I’ve seen some pretty weird stuff.
There are a lot of crawlers and bots that try to exploit known vulnerabilities, I mean in only a certain day there are maybe 100 tries via HTTP.
Looking in the logs of other services I can see the same pattern.
Funny though, the things they try will never work since I’m not using anything related to the software those bots are testing for.