Install GoAccess on Ubuntu for Log Analysis

By Anurag Singh

Updated on Jun 18, 2025

Install GoAccess on Ubuntu for Log Analysis

Learn how to install and configure GoAccess on Ubuntu for real-time Nginx or Apache web log analysis.

Introduction

GoAccess is an open-source, real-time web log analyzer and interactive viewer that helps us monitor and understand our server traffic through a visual dashboard. Designed to be fast and minimal, GoAccess processes web server log files (like those from Nginx or Apache) and turns raw data into meaningful insights — all from the command line or via a live HTML report.

Whether we’re running a personal blog, managing multiple client sites, or administering enterprise infrastructure, GoAccess gives us instant visibility into key metrics such as:

  • Top visitors (by IP)
  • Requested URLs and status codes
  • Bandwidth usage
  • Referrers and user agents
  • Geographic distribution
  • Real-time request activity

In this guide, we walk through the entire process of installing, configuring, and running GoAccess on an Ubuntu server.

Prerequisites

Before we begin, let’s ensure we have the following in place:

How to Install and Configure GoAccess on Ubuntu for Real-Time Nginx/Apache Log Analysis

Step 1: Update System Packages

Before installing any software, it's good practice to update the system:

sudo apt update && sudo apt upgrade -y

This ensures we have the latest security patches and package versions.

Step 2: Install GoAccess

GoAccess is available in Ubuntu’s default repository, but it’s usually an outdated version. To get the latest stable release with real-time HTML reporting support, we’ll add the official GoAccess repository.

sudo add-apt-repository ppa:goaccess-maintainers/goaccess
sudo apt update
sudo apt install goaccess -y

Once installed, verify the version:

goaccess --version

Step 3: Identify Web Server Log File

Depending on the web server we’re using:

Nginx log path (default):
/var/log/nginx/access.log

Apache log path (default):
/var/log/apache2/access.log

Make sure logs are being actively written to these files. Use:

sudo tail -f /var/log/nginx/access.log

Or:

sudo tail -f /var/log/apache2/access.log

Step 4: Analyze Logs in Terminal (Quick View)

To instantly view logs in the terminal with GoAccess:

For Nginx:

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

For Apache:

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

Use arrow keys to navigate the TUI dashboard.

Step 5: Generate a Static HTML Report

If we want a shareable report in browser format:

sudo goaccess /var/log/nginx/access.log --log-format=COMBINED -o /var/www/html/report.html

Then visit:

http://<server-ip>/report.html

Make sure Nginx or Apache is serving the /var/www/html directory.

Step 6: Set Up Real-Time HTML Dashboard

To get a live updating dashboard via WebSocket, we can use the following:

sudo goaccess /var/log/nginx/access.log --log-format=COMBINED -o /var/www/html/report.html --real-time-html --ws-url=<server-ip>

Now we can monitor logs in real time by visiting:

http://<server-ip>/report.html

Make sure port 7890 is open, as GoAccess uses it for WebSocket updates.

We can also reverse proxy WebSocket traffic with Nginx:

location /goaccessws {
    proxy_pass http://localhost:7890;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
}
  • Update --ws-url to:
  • --ws-url=ws://<server-ip>/goaccessws

Step 7: Create a Systemd Service for GoAccess

Let’s run GoAccess in the background as a systemd service so it starts on boot:

sudo nano /etc/systemd/system/goaccess.service

Paste the following:

[Unit]
Description=GoAccess Real-Time Log Analyzer
After=network.target

[Service]
ExecStart=/usr/bin/goaccess /var/log/nginx/access.log --log-format=COMBINED -o /var/www/html/report.html --real-time-html --ws-url=ws://yourdomain.com/goaccessws
Restart=always

[Install]
WantedBy=multi-user.target

Enable and start:

sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl enable goaccess
sudo systemctl start goaccess

Now GoAccess will continuously analyze logs in real time.

Step 8: Secure the Report with Basic Auth (Optional)

To prevent public access to sensitive data:

sudo apt install apache2-utils
sudo htpasswd -c /etc/nginx/.htpasswd admin

Update Nginx config:

location /report.html {
    auth_basic "Restricted Access";
    auth_basic_user_file /etc/nginx/.htpasswd;
}

Restart Nginx:

sudo systemctl restart nginx

Final Thoughts

With GoAccess installed and configured, we now have a real-time monitoring dashboard that gives valuable insights into visitor behavior, traffic trends, bandwidth usage, response times, and potential attacks.

It’s a lightweight yet powerful tool every server admin and DevOps engineer should include in their toolbox.

For best performance, integrate GoAccess with log rotation (logrotate) and ensure log formats are consistently structured.

If you're managing multiple sites or high-traffic platforms, this visibility can directly help in performance tuning and troubleshooting server issues before they escalate.