GoAccess is an open-source tool that allows to monitor web server logs. This tool supports various web log formats (Apache, Nginx, etc.). Web server statistics can viewed in terminal or in dashboard that can accessed to the user from a web browser.
This tutorial explains how to install GoAccess on Ubuntu 20.04.
Prepare environment
Make sure you have installed web server in your system. For example, you can install Apache by reading this post.
Install GoAccess
Download GPG key:
sudo wget -qO /etc/apt/trusted.gpg.d/goaccess.asc https://deb.goaccess.io/gnugpg.key
Execute the following command to add the GoAccess repository:
echo "deb https://deb.goaccess.io/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/goaccess.list
Update the package lists:
sudo apt update
Install GoAccess:
sudo apt install -y goaccess
When installation is completed, we can check GoAccess version:
goaccess --version
Testing GoAccess
For testing purpose we use Apache log files.
Run the following command to view statistics of the Apache access log in near real-time on the terminal:
goaccess /var/log/apache2/access.log --log-format=COMBINED
Press CTRL+C, to exit GoAccess.
You can also display statistics in near real-time HTML report which can be accessed through web browser.
sudo goaccess /var/log/apache2/access.log -o /var/www/html/report.html --log-format=COMBINED --real-time-html
Command puts report.html
output file under web server document root. You can open report.html
by going to URL address http://<IP_ADDRESS>/report.html
, where <IP_ADDRESS>
is IP address of your machine.
Testing GoAccess
If you want to completely remove GoAccess and related dependencies, run the following command:
sudo apt purge --autoremove -y goaccess
Remove GPG key and repository:
sudo rm -rf /etc/apt/trusted.gpg.d/goaccess.asc
sudo rm -rf /etc/apt/sources.list.d/goaccess.list
Leave a Comment
Cancel reply