GoAccess – A Real Time Apache & Nginx Log Analyzer

GoAccess – A Real Time Apache & Nginx Log Analyzer

GoAccess is a real-time log analyzer for web server on Unix/Linux systems. It alos allows to access logs via the web browser. The main purposes is to allow users to provide a quick way to analyze and view web server statistics in real time without needing a web browser.

It supports most of the web log formats (Apache, Nginx, Amazon S3, Elastic Load Balancing, CloudFront, Caddy, etc). You just need to set the log format and use. GoAccess also generates a complete, self-contained real-time HTML report, which is helpful for analytics, monitoring and data visualization. It also support JSON and CSV reports.

This tutorial describes you to how to install and use GoAccess on your Linux systems.

Installing GoAccess

Most of the Linux operating systems contains GoAccess packages in their official repositories. So you can simply install it with package manager.

  • Debian based systems:
    sudo apt-get update && sudo apt-get install goaccess -y
  • Redhat based systems:
    yum install goaccess
  • Arch Linux:
    pacman -S goaccess

For other operating systems visit this page to install Goaccess.

Use GoAccess from Terminal

Choose the log file based on your operating system and web server used. On Debian based systems log are generated under /var/log/apache2 directory and Redhat based system Apache create logs under /var/log/httpd directory. Use -f option to define the log file with goaccess command.

goaccess -f /var/log/apache2/access.log

Then select the log format. Default Apache log format is COMBINED.
GoAccess Select Log format

The GoAccess also allows you to define the log format with using --log-format command line options. For example, to use COMBINED log format the command will be:

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

You will see the output on system console like below:

GoAccess with Apache Logs

Press ‘Q’ to exit out of the GoAccess terminal viewer.

View GoAccess Output in Web Dashboard

GoAccess allows users to generate report in various formats like HTML, JSON and CSV. The HTML format generates a html page with all data in visual format. We can generate the report by using the following command in to a html file.

Let’s create a html report file under /var/www/html, which is the default document root set on my Apache server. The following command will generate html report:

sudo goaccess /var/log/apache2/access.log --log-format=COMBINED -a -o /var/www/html/report.html
  • -a – Enable a list of user-agents by host
  • -o – Used to define output file
  • Output format is automatically selected based on output filename extension

Next, access report.html using server ip address or domain name.

Goaccess web dashboard

Slide down to the webpage to display more information.

Auto Update Web Dashboard File

You can schedule goaccess command to update html report on regular interval. Create a shell script with following content:


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

Then schedule the above script with crontab:

sudo crontab -e

Add the following content to end of file

#Cron job to update Goaccess HTML repot
* * * * * /opt/goaccess.sh

Save crontab and close.


In this tutorial, you have learned abount GoAccess utility to view web server logs in visual formats.

The post GoAccess – A Real Time Apache & Nginx Log Analyzer appeared first on TecAdmin.

Goaccess Linux Tutorials TecAdmin