GoAccess - Apache2 Log Analyzer
January 8, 2025
I use GoAccess to generate reports for my web server. Following are the steps to get it running:
-
Per GoAccess installation instructions:
$ wget https://tar.goaccess.io/goaccess-1.9.3.tar.gz $ tar -xzvf goaccess-1.9.3.tar.gz $ cd goaccess-1.9.3/ $ ./configure --enable-utf8 --enable-geoip=mmdb $ make $ make install
-
Download latest GeoIP2 database from MaxMind. You need a free account with MaxMind. The download contains 3 databases:
GeoLite2-City.mmdb
GeoLite2-Country.mmdb
1GeoLite2-ASN.mmdb
Place downloaded files in
/usr/local/share/GeoIP/
.2
-
Edit GoAccess configuration file
/usr/local/etc/goaccess/goaccess.conf
. Make sure these lines are uncommented:log-format COMBINED enable-panel GEO_LOCATION
Add the following lines:
geoip-database /usr/local/share/GeoIP/GeoLite2-City.mmdb geoip-database /usr/local/share/GeoIP/GeoLite2-ASN.mmdb
-
Edit crontab (
sudo crontab -e
) to add:0 1 * * * (cd /var/log/apache2 && zcat access.log.*.gz | goaccess access.log access.log.1 - -o report.html)
Translation: every day at 01:00 pipe all compressed logs (
zcat
) and uncompressed ones throughgoaccess
and generatereport.html
output file.