Mind The GAp: Striking out on my own with GoAccess for server log analytics

Posted on <2017-05-01 Mon>

In which log-parsing and ncurses offer a soothing balm to the modern condition.

When setting up this site, I was keen to keep it as minimal as possible when it came to css and javascript. Mainly just to maintain my own sanity, such as it is, but also out of the desire to keep it light and fast. I did consider adding Google Analytics to the pages, but couldn't really justify it to myself. Having said that, it is nice to have some indication of traffic, so I started looking for analytics tools built to work with server logs.

I'll be honest, I didn't look for very long because one of the first links I found was [goaccess](https://goaccess.io/) - which so far works really well. You can feed it log files, and browse them via an ncurses interface, or generate html, or have it host a real-time web page for you. It can parse plenty of standard log formats out of the box, or you can teach it about your own specific logging output. It was also nice to realise that it was included in the ubuntu repos so it was just an apt-get away.

goaccess-demo.png

NB: The version currently included in the ubuntu repos has a slightly different command line interface than that described on their website, so make sure to check the manpages for your installed version, if you install it that way.

I don't need the adrenaline rush of a real time dashboard, so I just set it up with a simple cron job that generates html:

zcat -f access.* | goaccess > report.html

I'd be lying if I said I didn't enjoy ssh'ing from time to time and running the ncurses interface as well.