LinuxCommandLibrary

goaccess

Analyze web server access logs

TLDR

Analyze one or more log files in interactive mode

$ goaccess [path/to/logfile1 path/to/file2 ...]
copy

Use a specific log-format (or pre-defined formats like "combined")
$ goaccess [path/to/logfile] --log-format=[format]
copy

Analyze a log from stdin
$ tail [[-f|--follow]] [path/to/logfile] | goaccess -
copy

Analyze a log and write it to an HTML file in real-time
$ goaccess [path/to/logfile] [[-o|--output]] [path/to/file.html] --real-time-html
copy

SYNOPSIS

goaccess [options] [-f log_file]
goaccess [options] < log_file

PARAMETERS

-f <log_file>
    Specifies the path to the input log file to parse. Use '-' to read from standard input.


-a
    Enables parsing and tracking of User-Agents.


-d
    Enables parsing and tracking of hostnames. Requires a DNS resolver to be enabled.


-p <config_file>
    Specifies a custom configuration file instead of the default.


--log-format=<format>
    Manually sets the log format string. Refer to the configuration file for syntax.


--date-format=<format>
    Manually sets the date format string. Refer to the configuration file for syntax.


--time-format=<format>
    Manually sets the time format string. Refer to the configuration file for syntax.


-o <output_file>
    Writes the HTML, JSON, or CSV report to the specified file. The output format is determined by the file extension.


--real-time-html
    Enables real-time HTML report generation with WebSocket support.


-c
    Generates a default configuration file to stdout.


-m
    Enables ncurses colored metrics on the terminal output.


-q
    Suppresses output to the terminal, useful when only generating a report file.


--ignore-ip=<IP>
    Ignores the specified IP address from the statistics.


DESCRIPTION

GoAccess is an open-source, real-time web log analyzer and interactive viewer that runs in a terminal or through your browser. It provides fast and insightful HTTP statistics for system administrators who require a visual server report on the fly. It parses web server access logs (e.g., Apache, Nginx, Amazon S3, CloudFront) and displays a comprehensive set of metrics including unique visitors, requested files, static files, 404s, hosts, operating systems, browsers, referrers, keywords, HTTP status codes, geo-location, and more. GoAccess can process logs incrementally and provide a real-time HTML report, making it ideal for monitoring live traffic. Its ability to parse various log formats and output to multiple formats (interactive terminal, HTML, JSON, CSV) makes it a versatile tool for web analytics and server health monitoring.

CAVEATS

While GoAccess is highly efficient, processing extremely large log files (multiple gigabytes) can still consume significant memory and CPU resources, especially when parsing extensive datasets like User-Agents or DNS lookups. For real-time HTML output, ensure that WebSocket connections are properly handled by your web server or proxy to allow updates. Accurate parsing heavily relies on correctly defining the log, date, and time formats; misconfigurations can lead to incorrect or incomplete statistics.

<B>INTERACTIVE TERMINAL UI</B>

GoAccess provides an interactive terminal user interface that allows users to explore various statistics by navigating through different modules and sorting data. This is its default mode when no output file is specified.

<B>CUSTOMIZABLE LOG FORMATS</B>

A key strength of GoAccess is its flexibility in parsing custom log formats. Users can define their log, date, and time formats using directives, making it compatible with virtually any web server log, CDN log (e.g., CloudFront), or load balancer log.

<B>MULTIPLE OUTPUT FORMATS</B>

Beyond its interactive terminal view, GoAccess can export reports to HTML (for browser viewing, including real-time updates), JSON (for programmatic consumption), and CSV (for spreadsheet analysis). This versatility caters to different reporting and integration needs.

HISTORY

GoAccess was initially released in 2010 by Gerardo Gallard as an open-source project. It was developed to address the need for a simple, fast, and real-time web log analyzer that could run directly in the terminal, offering an alternative to more complex or resource-intensive solutions. Its development has been driven by community contributions, adding support for various log formats, real-time HTML output, and numerous statistical modules, solidifying its position as a popular choice for quick web server insights.

SEE ALSO

grep(1), awk(1), sed(1), tail(1), apachetop, webalizer, awstats

Copied to clipboard