Published 2020-08-23 on Anjan's Homepage
1 The problem and alternative solution
- You are not able to debug which pages might be down or not working
- You don't have insight into which pages are the biggest burden to serve
- You don't know what content attracts visitors
- You don't get a hit of dopamine by observing the growth of your blog
I found a solution that gives me insight into my website but preserves user freedom. "GoAccess, is an open source real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems or through your browser". Basically, goaccess reads in nginx or apache log files and outputs various analytics about your site.
On my server, I run the following command to analyze my nginx logs:
zcat -f /var/log/nginx/access.log*.gz | cat /var/log/nginx/access.log - | grep -v 192.168.1.0 | goaccess -f -
nginx compresses older access logs into
access.log*.gz so I used zcat to decompress and concatenate all the archives.
The ip address:
192.168.1.0 represents http requests from my LAN.
I only want to analyze traffic on WAN so I excluded 192.168.1.0 by running
grep -v 192.168.1.0 where the -v flag "selects non-matching lines".
When goaccess opens, I select "NCSA Combined Log Format" and press Enter. Finally, I get the following output:
I prefer cli output but you can also get an html webpage to view.
Since IP addresses can be used to track users, I obfuscate ip addresses with nginx. I left "log full ip address on hack / access denied attempts" on as the tutorial suggests. Logging IPs on error allows me to use tools like fail2ban to ban ip addresses that are trying to bruteforce my server. I also setup log rotation to delete my nginx logs older than 7 days. The log data stays on my server and is not exported to any other third party.
Hopefully goaccess gives you more motivation to write!
Articles from blogs I follow around the netThese articles/blogs do not represent my own opinions or views.
I work on free and open-source software full time, and I make a comfortable living doing it. And I don’t half-ass it: 100% of my code is free and open-source. There’s no proprietary add-ons, no periodic code dumps, just 100% bona-fide free and open source so…via Drew DeVault's blog November 20, 2020
From the Neolithic to the beginning of the twentieth century, coppiced woodlands, pollarded trees, and hedgerows provided people with a sustainable supply of energy, materials, and food.via LOW←TECH MAGAZINE September 20, 2020
I’ve used and defended Eshell for years. Sadly, Eshell has some long standing issues that I grew tired of in the long run. So I’ve decided to switch to M-x shell and see how much of my Eshell workflow I could port. Language and the underlying shell pr…via Pierre Neidhardt's homepage June 26, 2020
Generated by openring