GoAccess Tool, Monitor Real-Time Apache and Nginx Server Log

GoAccess is very popular free and open source web server log monitoring tool for linux based system.

Log can be viewed in both text-based as well as web application user interface.

GoAccess parse and analyze the log of Apache and Nginx located in /var/log directory and display it in user readable format.

There is multiple format available like CLF (Common Log Format), W3C format (IIS), and Apache virtual hosts, and then generate the output.

Related: How to make advanced Configuration in the UFW firewall?

Check live demonstration of GUI GoAccess https://rt.goaccess.io/

GoAccess Features

GoAccess has following feature

  • Display Uniqure visitor per day – (Including web spider)
  • Monitor User Reqested files
  • Display break URL Not Found (404)
  • User Hostname, Ip and Operating System
  • Requested user browser
  • Pages where spent more time
  • User Geo Location
  • HTTP Status Code
  • Ability to output these data into Json or CSV

Installation Steps

Ubuntu do not provide latest verson of the package in there official repository. so, to install the latest versio of GoAccess, you need to manually download and compile it from its source code.

From Source

Installation on Debian and Ubuntu

$ sudo apt install libncursesw5-dev libgeoip-dev apt-transport-https 
$ cd /usr/src
$ wget https://tar.goaccess.io/goaccess-1.4.tar.gz
$ tar -xzvf goaccess-1.4.tar.gz
$ cd goaccess-1.4/
$ sudo ./configure --enable-utf8 --enable-geoip=legacy
$ sudo make
$ sudo make install

Installation on CentOS, RHEL and Fedora

# yum install ncurses-devel glib2-devel geoip-devel
# cd /usr/src
# wget https://tar.goaccess.io/goaccess-1.4.tar.gz
# tar -xzvf goaccess-1.4.tar.gz
# cd goaccess-1.4/
# ./configure --enable-utf8 --enable-geoip=legacy
# make
# make install

The easiest and most preferred way to install GoAccess on your Linux System is using package manager. But as I mentioned before not all the Linux system have latest version GoAccess in there repo.

Installation on Debian, Ubuntu, and Pop OS

Enter below command in terminal to install.

sudo apt-get install goaccess

Debain offical repository do not provide latest version of GoAccess to install latest version of GoAccess perform below task.

$ echo "deb http://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/goaccess.list
$ wget -O - https://deb.goaccess.io/gnugpg.key | sudo apt-key --keyring /etc/apt/trusted.gpg.d/goaccess.gpg add -
$ sudo apt-get update
$ sudo apt-get install goaccess

Fedora

# yum install goaccess

Arch Linux

# pacman -S goaccess

Gentoo

# emerge net-analyzer/goaccess

If you want take taste of GoAccess in windows based system try to use CowAxess which is GoAccess implementation for Window Based System.

How to use GoAccess

To access report of apache or nginx on your system use below command.

For Apache

# goaccess -f /var/log/httpd/access.log

For Nginx

# goaccess -f /var/log/nginx/access.log

After executing above command it ask to to choose preferred format to show data like below screen.

GoAccess log format

We prefer to use Common Log Format (CLF) to view log.

Apache Log Overview

Apache GoAccess Log

Operating System, Browsers, Time Distribution

GoAccess log

How to generate GoAccess Apache and Nginx Report?

To generate HTML output of your webserver to share to other people or view graphically use below command.

For Apache

# goaccess -f /var/log/httpd/access.log > reports.html

For Nginx

# goaccess -f /var/log/nginx/access.log > reports.html
reports.html

If any query drop us comment

Leave a Reply