Generate Access.log Statistics into HTML with GoAccess
Published on July 19, 2022
GoAccess is a visual web analyzer tool that can be configured to work just any other analytics solution. And quite frankly, it is extremely powerful for parsing direct incoming traffic to your server and any websites you might host on it.
In order to install GoAccess on your Linux server:
sudo apt install goaccess
And to convert your access.log files into HTML you can use the following snippet:
# first step is to combine all your logs into one big file zcat -f /var/log/apache2/access.log* > /var/log/apache2/access-combined.log # next step is to convert the log file into HTML goaccess \ --log-file=/var/log/apache2/access-combined.log \ --log-format=COMBINED \ --exclude-ip=0.0.0.0 \ --ignore-crawlers \ --real-os \ --output=/var/www/html/logs.html # it might take a while to parse all the logs depending on how big your files are
Once done, you can go to the logs.html page to see your Server Statistics report.
Some additional notes:
- Remember to remove your generated files (.html and .log) when you’re finished.
- The access.log file location depends on the Web Server that you’re using. It’s different for NGINX and Apache2 and other servers, but typically all share the same /var/log/ folder structure.
- This is a one-time barebones solution. However, if you like the interface of GoAccess – it is possible to set it up as a real-time analytics solution.