GoAccess is a free, open-source, lightweight log analyzer written in C language. It can read and analyze log files of Apache, Nginx, CloudFront, Caddy, and more. It uses the ncurses library for its CLI interface. It is an interactive and real-time web server log analyzer that helps you to analyze and view web server logs quickly.
- Display general Statistics, and bandwidth
- Support for HTTP/2 and IPv6
- Display metrics per virtual host
- Support for large datasets + data persistence
- Display top visitors, referring sites, and URLs
In this post, we will show you how to install GoAccess Web Log Analyzer on Rocky Linux 8.
- A server running Rocky Linux 8 on the Atlantic.Net Cloud Platform
- A root password configured on your server
Step 1 – Create Atlantic.Net Cloud Server
First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Rocky Linux 8 as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.
Once you are logged in to your server, run the following command to update your base system with the latest available packages.
dnf update -y
Step 2 – Install Required Packages
First, you will need to install the required tools on your server. You can install all of them with the following command:
dnf install httpd ncurses-devel libmaxminddb-devel openssl-devel
dnf groupinstall 'Development Tools'
Once all the packages are installed, start and enable the Apache service using the following command:
systemctl start httpd
systemctl enable httpd
Step 3 – Install GoAccess on Rocky Linux 8
By default, GoAccess is not included in the Rocky Linux default repo, so you will need to compile it from the source.
First, download the latest version of GoAccess with the following command:
Once the download is completed, extract the downloaded file with the following command:
tar -xvzf goaccess-1.5.4.tar.gz
Next, change the directory to the extracted directory and compile it using the following command:
./configure --enable-utf8 --with-openssl
Once the installation is complete, verify the GoAccess version with the following command:
You will get the following output:
GoAccess - 1.5.4.
For more details visit: https://goaccess.io/
Copyright (C) 2009-2020 by Gerardo Orellana
Build configure arguments:
Step 4 – Configure GoAccess
The GoAccess main configuration file is located at /usr/local/etc/goaccess/goaccess.conf. Most of the options are commented out, so you will need to edit the file and enable the required options.
Change the following lines to enable and disable some recommended options:
Save and close the file when you are finished.
Step 5 – Run GoAccess
First, we will run the GoAccess by specifying the Apache log file. The Apache log files keep a record of all incoming HTTP traffic. You can analyze and monitor the Apache logs using the following command:
You should see the following interface:
In the above interface, you should see the Apache logs including the following:
- Unique visitors per day
- Requested Files (URLs)
- Static Requests
- Not Found URLs (404s)
- Visitor Hostnames and IPs
- Operating Systems
- Time Distribution
- Virtual Hosts
Step 6 – Generate HTML Reports
GoAccess also allows you to generate HTML reports which you can access online through the web browser.
Run the following command to generate an HTML report:
goaccess /var/log/httpd/access_log -o /var/www/html/stats.html
Now, open your web browser and access the generated reports using the URL http://your-server-ip/stats.html. You should see the following dashboard:
Now, go back to your terminal and press the CTRL+C to close the GoAccess.
GoAccess also allows you to generate a real-time HTML report. Run the following command to generate a real-time report and run GoAccess in the background:
goaccess /var/log/nginx/access.log -o /var/www/html/livereport.html --real-time-html --daemonize
You can now access the GoAccess real-time report using the URL http://your-server-ip/livereport.html. You should see the following screen:
Now, go back to your terminal and kill the GoAccess process using the following command:
kill -9 `pidof goaccess`
In this guide, we explained how to install and configure GoAccess Log Analyzer on Rocky Linux 8. We also explained how to monitor Apache web server logs in real-time through the web browser. Try it on dedicated hosting from Atlantic.Net!