/ tools

GoAccess, how to get started

What is it?

GoAccess is an open source real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems or through your browser.
It provides fast and valuable HTTP statistics for system administrators that require a visual server report on the fly.

Why GoAccess?

GoAccess was designed to be a fast, terminal-based log analyzer. Its core idea is to quickly analyze and view web server statistics in real time without needing to use your browser (great if you want to do a quick analysis of your access log via SSH, or if you simply love working in the terminal).

While the terminal output is the default output, it has the capability to generate a complete, self-contained real-time HTML report (great for analytics, monitoring and data visualization), as well as a JSON, and CSV report.


1. Installation

It is easiest to install GoAccess on Linux using the preferred package manager of your Linux distribution. Please note that not all distributions will have the lastest version of GoAccess available

Distributions:

  • OSX (Homebrew)
    brew install goaccess

2. Determine Log Format

Once you have GoAccess installed on a machine, then you should be ready to start using it. However, first you need to determine the log format of your access log. GoAccess comes with several predefined log format options that you can use. Either you can set them permanently in your configuration file or simply passing it through the command line.

  • On OSX (MAMP)
    I can enable the Apache HTTP access logs, since they are disabled by default on MAMP. To enable them, do the following:
  1. Open the Apache HTTP configuration at /Applications/MAMP/conf/apache/httpd.conf
  2. Find a line similar to CustomLog /Applications/MAMP/logs/apache_access_log combined, or just replaced or uncomment (since its commented by default).
  3. Restart Apache using the MAMP.
  4. Now, view or test your new logfiles! tail -f /Applications/MAMP/logs/apache_access_log

3. Run GoAccess

At this point you are ready to run GoAccess against your access log(s). The following are the most basic and common scenarios.

3.1 Terminal Output

The following prompts a log configuration dialog with predefined log formats for you to choose from and then displays the stats in real-time.
goaccess /Applications/MAMP/logs/apache_access_log -c

3.2 Real-Time HTML Output

The following parses the access log and displays the stats in a real-time HTML report.
goaccess /Applications/MAMP/logs/apache_access_log -o /Users/<user>/www/htdocs/goaccess/report.html --log-format=COMBINED --real-time-html

NOTES:

  • You should place your report.html output file under your Web Server document root.
  • You should be able to simply open your report.html by navigating the browser to your document root URL. e.g., http://example.com/report.html
GoAccess, how to get started
Share this

Subscribe to NL Slack