colorful foto of a macbook keyboard

How to simply analyze access logs of web servers

By

in

There is a tool for that: GoAccess. It’s an easy to use command line tool to analyze any access log and create beautiful insights.

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.

https://goaccess.io/

Installation

On macOS you can use HomeBrew to install GoAccess:

brew install goaccess

For other operation systems, please check out the detailed documentation on their website. This tool runs on different Linux distributions like Ubuntu, Fedora and others and even on Windows.

Usage

The most elegant way is the terminal output. For this, simply type:

 goaccess access.log --log-format=COMBINED

Which creates such an output (you can navigate down to see much more details):

screenshot of log statistics in terminal window

You can also create an html file that you can view in your browser:

goaccess access.last.log -o report.last.html --log-format=COMBINED

And voilà:

screenshot of log statistics

If your terminal is not using the same language as your log files do, then you might need to set LC_TIME for a correct parsing of the log files:

LC_TIME="en_US.UTF-8" goaccess access.last.log -o report.last.html --log-format=COMBINED

To learn more about all options, you can check out the documentation of GoAccess.

Photo by Aryan Dhiman on Unsplash.



Comments

Leave a Reply

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