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.
For additional information about GoAccess configuration and troubleshooting not covered here, refer to the GoAccess manual.
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 and find specific instructions for the local machine’s operating system.
- For macOS, using homebrew is recommended:
brew install goaccess
- For Windows, there is a 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.
Preparing compressed log files for GoAccess reporting
VIP’s log shipping delivers a series of gzipped (compressed) JSON log files. Because GoAccess can only parse uncompressed log files, those files must be uncompressed first. A popular command-line option is to use the gunzip
command.
This example command demonstrates how to uncompress a gzip (.gz
) archive named 17_50_0.gz
:
gunzip 17_50_0.gz
The command above will remove the 17_50_0.gz
file and create a file named 17_50_0
with the uncompressed content.
Create and view a report
Note
If the local machine locale is not set to English, LC_TIME
will need to be set in order to process the logs:
LC_TIME="en_US.UTF-8" bash -c 'goaccess access.log --log-format=COMBINED'
Additional formatting options will likely need to be set in the command line or in a GoAccess configuration file in order to successfully ingest the JSON-formatted HTTP request log files.
Refer to the GoAccess manual as the most accurate and up to date reference for format options and configurations.
Use the goaccess
command in a terminal to view a report.
In this example command goaccess
is accessing multiple uncompressed log files, separated by a space:
goaccess 17_50_0 17_55_0 18_00_0 18_05_0 18_10_0
To create an HTML report, run a command similar to the following example:
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 the log information in a set of graphs similar to this example screen shot.
Last updated: January 17, 2024