GoAccess is an open-source log analysis tool designed to help system administrators and developers monitor web server activity in real-time. With an intuitive terminal-based interface and support for web-based reports, GoAccess has become a popular choice for analyzing log files from web servers like Nginx or Apache.

Installing GoAccess

To install GoAccess on Debian or Ubuntu-based systems, you can use the apt package manager.

sudo apt install goaccess

On RPM-based systems like CentOS, Rocky Linux, and AlmaLinux, you can use dnf to install GoAccess.

sudo dnf install goaccess

How to Run GoAccess

Once the installation is complete, you can run GoAccess directly from the terminal. For example, to read the access log from an Nginx web server, follow these steps:

The Nginx access log file is usually located at /var/log/nginx/access.log. To analyze this file, use the following command:

sudo goaccess /var/log/nginx/access.log --log-format=COMBINED

The COMBINED log format is the standard format used by Nginx and Apache.

Real-Time Reports with Web UI

GoAccess also supports a web UI for viewing reports in real-time. This feature is particularly useful if you want to monitor server activity from a browser.

Use the following command to generate real-time HTML reports:

sudo goaccess /var/log/nginx/access.log --log-format=COMBINED --real-time-html --output=/var/www/html/report.html
  • --real-time-html: Enables real-time report updates.
  • --output=/var/www/html/report.html: Saves the HTML report in the web server directory.

Access report.html from your browser at http://Server-IP/report.html.

To run GoAccess as a daemon, add the --daemonize option:

sudo goaccess /var/log/nginx/access.log --log-format=COMBINED --real-time-html --output=/var/www/html/report.html --daemonize