GoAccess (A Real-Time Apache and Nginx) Web Server Log Analyzer

GoAccess is an interactive and real time web server log analyzer program that quickly analyze and view web server logs. It comes as an open source and runs as a command line in Unix/Linux operating systems. It provides brief and beneficial HTTP (web server) statistics report for Linux administrators on the fly. It also take care of both the Apache and Ngnix web server log formats.

GoAccess parses and analyze the given web server log formats in preferred options including CLF (Common Log Format), W3C format (IIS) and Apache virtual hosts and then generate output of the data to the terminal.

GoAccess Features

It has the following features.

  1. General Statistics, bandwidth etc.
  2. Top Visitors, Visitors Time Distribution, Referring Sites & URLs and 404 or Not Found.
  3. Hosts, Reverse DNS, IP Location.
  4. Operating Systems, Browsers and Spiders.
  5. HTTP Status Codes
  6. Geo Location – Continent/Country/City
  7. Metrics per Virtual Host
  8. Support for HTTP/2 & IPv6
  9. Ability to output JSON and CSV
  10. Incremental log processing and support for large datasets + data persistence
  11. Different Color Schemes

How Do I Install GoAccess?

Presently, the most recent version of GoAccess 0.9.7 is not available from default system package repositories, so to install latest stable version, you need to manually download and compile it from source code under Linux systems as shown:

Install GoAccess from Source

# yum install ncurses-devel glib2-devel geoip-devel
# cd /usr/src
# wget http://tar.goaccess.io/goaccess-0.9.8.tar.gz
# tar zxvf goaccess-0.9.8.tar.gz
# cd goaccess-0.9.8/
# ./configure
# make; make install

Install GoAccess Using Package Manager

The easiest and preferred way to install GoAccess on Linux using the default package manager of your respective Linux distribution.

Note: As I said above, not all distributions will have the most recent version of GoAccess available in the system default repositories..

On RedHat, CentOS and Fedora
# yum install goaccess
# dnf install goaccess    [From Fedora 23+ versions]
On Debian and Ubuntu Systems

GoAccess utility is available since Debian Squeeze 6 and Ubuntu 11.04. To install just run the following command on the terminal.

# apt-get install goaccess

Note: The above command will not always provide you the most latest version. To get the latest stable version of GoAccess, add the official GoAccess Debian & Ubuntu repository as shown:

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

How Do I Use GoAccess?

Once, goaccess is installed, execute ‘goaccess‘ command without any arguments will list the help menu.

# goaccess
Sample Output
GoAccess - 0.9.8

Usage: goaccess [ options ... ] -f log_file [-c][-M][-H][-q][-d][...]
The following options can also be supplied to the command:

Log & Date Format Options

  --log-format=        - Specify log format. Inner quotes need to
                                    be escaped, or use single quotes.
  --date-format=      - Specify log date format. e.g.,
                                    %d/%b/%Y
  --time-format=      - Specify log time format. e.g.,
                                    %H:%M:%S

User Interface Options

  -c --config-dialog              - Prompt log/date/time configuration
                                    window.
  -i --hl-header                  - Color highlight active panel.
  -m --with-mouse                 - Enable mouse support on main dashboard.
  --color=<fg:bg[attrs, PANEL]>   - Specify custom colors. See manpage for
                                    more details and options.
  --color-scheme=<1|2>            - Color schemes: 1 => Grey, 2 => Green.
  --html-report-title=     - Set HTML report page title and header.
  --no-color                      - Disable colored output.
  --no-column-names               - Don't write column names in term
                                    output.
  --no-csv-summary                - Disable summary metrics on the CSV
                                    output.
  --no-progress                   - Disable progress metrics.
  --no-tab-scroll                 - Disable scrolling through panels on TAB.

File Options

  -f --log-file=        - Path to input log file.
  -l --debug-file=      - Send all debug messages to the specified
                                    file.
  -p --config-file=     - Custom configuration file.
  --invalid-requests=   - Log invalid requests to the specified
                                    file.
  --no-global-config              - Don't load global configuration
                                    file.
.....

The easiest way to get the any web server statistics use the flag ‘f‘ with input log file name as shown below. The below command will give you general statistics of your web server logs.

# goaccess -f /var/log/httpd/tecmint.com
# goaccess -f /var/log/nginx/tecmint.com

The above command gives you an complete overview of web server metrics by showing summaries of various reports as panels on a one scrollable view as shown.

Apache Logs Overview

View Web Server Apache Logs

View Web Server Apache Logs

Apache Logs by Operating System – Overview

View Apache Logs By Operating System

View Apache Logs By Operating System

Apache Logs by Visitor Bandwidth – Overview

View Apache Visitor Bandwidth Usage

View Apache Visitor Bandwidth Usage

Apache Logs by Web Browser – Overview

View Apache Usage based on Browsers

View Apache Usage based on Browsers

How do I generate Apache HTML report?

To generate an HTML report of your Apache webserver logs, just run it against your web log file.

# goaccess -f /var/log/httpd/access_log > reports.html
Monitor Apache Logs Using Web Browser

GoAccess: Monitor Apache Logs Using Web Browser

For more information and usage please visit http://goaccess.io/.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

14 Responses

  1. rlinux57 says:

    How it can be work in cpanel server, getting below error ?
    #goaccess -f /usr/local/cpanel/logs/access_log

    GoAccess – version 0.9.8 – May 20 2016 13:21:04
    Config file: /usr/local/etc/goaccess.conf

    Fatal error has occurred
    Error occured at: src/parser.c – verify_formats – 2215
    No time format was found on your conf file.

  2. Jalal Hajigholamali says:

    Thanks a lot
    very nice article…

  3. bheema says:

    Hi Ravi,

    I am getting the below error, please let me know where i have to make changes and I am not able to find out .goaccessrc file.

    [[email protected] goaccess-0.5]# goaccess -f /var/log/httpd/

    GoAccess – version 0.5 – Oct 16 2015 02:38:28

    An error has occurred
    Error occured at: goaccess.c – render_screens – 239
    Message: Nothing valid to process.

    • Ravi Saive says:

      @Bheema,
      Change the format as shown in the configuration it should work..

      date_format %d/%b/%Y
      log_format %^, %h %^[%d:%^] "%r" %s %b "%R" "%u"
      
  4. Devakumar says:

    Hi,

    i’ve installed goaccess on my apache machines.. would it be possible to send notification/alert email from goaccess ? .. if not could you suggest me any product (freeware).

  5. Pierre says:

    Hello, I just start with Goaccess, is there a way to know pageviews per mouth?
    I can’t find info?

    merci

  6. anand vamsi says:

    Hi

    Is it possible to parse the logs from remote server ie. if i have apache server running in 192.168.1.2 and logs placed in /var/log/apache.log in the same server .is it possible to watch the stats from 192.168.1.3(where go access is installed)

    Please help me

    • Ravi Saive says:

      Anand, I never tried on the remote machine, but you should give a try, if it works for you then it definitely works others too and don’t forget to post your output here, if you’ve tried.

  7. Samson Mugo says:

    Yea, Version 0.6 fixed the F10 key binding issue. Great post Ravi, just what I needed. Very cool that it is real time.

  8. Lance says:

    This is works awesome on my nginx server. Version 0.6 just came out which fixed the F10 key in gnome term.

  9. James says:

    I had the same issue, however, I configured my log format/date in my: ~/.goaccessrc

    color_scheme 1
    date_format %d/%b/%Y
    log_format %h %^[%d:%^] %^ “%r” %s %b “%R” “%u”

  10. nobicycle says:

    Interesting, but the terminal I use captures F10, which prevents specifying the log format. Log format cannot be specified on the command line either.

Leave a Reply to Jalal Hajigholamali Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.