Skip to content

Backgrounds

How-to Guides

Technical References

Analyze your HTTP request logs with GoAccess

Analyzing your access logs can provide crucial insight into how your application is performing and how your audience is interacting with your content. In this article we’ll cover how to use the open source tool, GoAccess, to help you visualize your access log data so you can gain deeper insights into your application.

For additional information about GoAccess configuration and troubleshooting not covered here, refer to the GoAccess manual.

Prerequisite:

  • The Log Shipping tool must be enabled on your VIP Go site.
  • The logs you would like to analyze must be downloaded from the S3 bucket and onto your computer.

Install GoAcess

To install GoAccess, go to their download page where you will find specific instructions for your operating system.

For macOS we recommend using homebrew: brew install goaccess

For Windows, you have the choice between a specific Windows implementation called CowAxess which provides an installer file or using the Windows Subsystem for Linux and following the Linux installation steps.

Configure GoAccess

Once GoAccess is installed, you will need to configure it to parse the VIP Go logs.

The GoAccess configuration file will be either ~/.goaccessrc or /%sysdir%/goaccess.conf where %sysdir% is one of /usr/etc/, /etc/, or /usr/local/etc.

Open that file, and add the following formatting options:

# Set time format
time-format %T

# Set date format
date-format %d/%b/%Y

# Set log format
log-format { "body_bytes_sent": "%b", "content_type": "%M", "http_host": "%v", "http_referer": "%R", "http_user_agent": "%u", "http_version": "%H", "remote_addr": "%h", "remote_user": "%e", "request_time": "%T", "request_type": "%m", "request_url": "%U", "sent_x_cache": "%C", "status": "%s", "timestamp": "%d:%t %^", "tls_version": "%K", "wplogin": "%e" }

Note

If your machine locale is not set to English, to process the logs you will need to set your LC_TIME:

LC_TIME="en_US.UTF-8" bash -c 'goaccess access.log --log-format=COMBINED'

Create a Report with GoAccess

To view a report in your terminal, you can use the following command:

goaccess 17_50_0 17_55_0 18_00_0 18_05_0 18_10_0

The command above is simply calling goaccess and then passing it a number of access logs, like 17_50_0, separating them by a space.

If you want to create an HTML report, you can run the following command in your terminal:

goaccess 17_50_0 17_55_0 18_00_0 18_05_0 18_10_0 > logreport.html

Opening up the logreport.html file will display your log information in a nice set of graphs:

Viewing VIP Go logs in an HTML report generated by GoAccess

Last updated: May 05, 2021