Installing GoAccess, Ubuntu 14.04, for Nginx access logs

I've discovered a very nice tool for simple web analytics with Nginx. It's called GoAccess. I found out about it via here, and installed it. It works great.

I'd recommend updating your apt-get sources so you get the latest version. Here's an excerpt from the download page that I ran:

echo "deb $(lsb_release -cs) main" | tee -a /etc/apt/sources.list
wget -O - | apt-key add -
apt-get update
apt-get install goaccess

At first I didn't follow these steps, and ended up with an older version that was lacking command-line options I needed.

I wanted to have GoAccess output an HTML file to show me the statistics from my Nginx log. The GoAccess FAQ mentions how to configure GoAccess for Nginx logs, and this page helped show me how to create and use a log format file.

I ended up creating a file called goaccess_nginx.txt, with the exact log format excerpt from the GoAccess FAQ:

date-format %d/%b/%Y
log-format %h %^[%d:%^] "%r" %s %b "%R" "%u"

and then I created a shell script with the following command:

goaccess -p goaccess_nginx.txt -f /path/to/nginx/access.log -a > report.html

and running it created a report.html file with my web stats!


Leave a comment

What color are brown eyes? (spam prevention)
Code under MIT License unless otherwise indicated.
© 2020, Downranked, LLC.