Analyze HTTP request logs with GoAccess
Analyzing HTTP request logs can provide crucial insight into how an application is performing and how an audience is interacting with content. GoAccess is an open source tool that can be used to visualize request log data to can gain deeper insights into an application.
Prerequisites
HTTP request log shipping must be enabled.
Shipped logs must be downloaded from the S3 bucket and onto a local computer.
Install GoAccess
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.
For additional information about GoAccess configuration and troubleshooting not covered here, refer to the GoAccess manual.
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:
![](https://webcf.waybackmachine.org/web/20211102061139im_/https://docs.wpvip.com/wp-content/uploads/sites/2/2020/11/Screen-Shot-2020-11-23-at-9.57.50-AM.png?w=1024)