Follow through this guide to learn how to install GoAccess on Fedora 30/Fedora 29. GoAccess is an opensource real-time visual and interactive web log analyzer that can run on both the terminal and browser.
Install GoAccess On Fedora 30/Fedora 29
GoAccess is available on the default Fedora repositories. However, the available versions may not be the latest stable release version. Hence, the surest way is to install GoAccess from source as this ensures that you got the latest version running. As of this writing, GoAccess v1.3 is latest version.
Run system update
Install required dependencies
Usually, Ncurses is the only required dependency. However, we are going to install it, required build tools and other optional dependencies.
dnf install ncurses-devel gcc make geoip-devel tokyocabinet-devel openssl-devel
Download GoAccess Tarball
Run the command below to download GoAccess v1.3 source code.
Extract the Source Code
Once the download is done, extract the source code.
tar xzf goaccess-1.3.tar.gz
Next, navigate to GoAccess source directory and run the configure script to prepare GoAccess for installation on your Fedora system.
cd goaccess-1.3/ ./configure --enable-utf8 --enable-geoip=legacy
If the configuration completes successfully, you should be able to get such a summary below;
... Your build configuration: Prefix : /usr/local Package : goaccess Version : 1.3 Compiler flags : -pthread Linker flags : -lncursesw -lGeoIP -lpthread Dynamic buffer : no Geolocation : GeoIP Legacy Storage method : In-memory Hash Database (Default) TLS/SSL : no Bugs : [email protected]
Compile and Install GoAccess on Fedora 30/Fedora 29
Run the commands below to compile and install GoAccess.
make make install
If the installation is successful, GoAccess binary is placed on /usr/local/bin/goaccess.
GoAccess can be run on the terminal to generate log analysis results to standard output or as html report. The basic command line syntax for GoAccess is;
goaccess [filename] [options…] [-c][-M][-H][-q][-d][…]
The most basic usage is to pass the log to analyse to GoAccess. For example;
This will open a Log, date and time format configuration prompt.
Press space bar to select the format and press Enter to analyze the logs. The log analysis dashboard is presented on the terminal.
Scroll up and down to view dashboards.
If the logs being analyzed doesn’t support the default log formats for GoAccess, you can specify your log format, date and time format with the options, –log-format, –date-format and –time-format.
For example, if you have squid logs with the EPOCH timestamp;
goaccess /var/squid/logs/access.log --log-format='%x.%^ %~ %L %h %^/%s %b %m %U %^' --date-format=%s --time-format=%s
If you need to display the analysis on a web format, save the output of a log file into an HTML file on your web root directory. In this case, you need to have a web server installed, we are using Apache in this guide,
dnf install httpd
To generate a web report, for Apache Access logs;
goaccess /var/log/httpd/access.log --log-format=COMBINED -a -o /var/www/html/analysis.html
If you access your browser via http://<server-IP>/analysis.html you should be able to see your GoAccess analytic dashboards.
For analyzing squid logs with custom format;
goaccess /var/squid/logs/access.log --log-format='%x.%^ %~ %L %h %^/%s %b %m %U %^' --date-format=%s --time-format=%s -a -o /var/www/html/analysis.html
Access the report via http://<server-IP>/analysis.html.
To parse the logs and display the stats in a real-time HTML report, use the –real-time-html option.
goaccess access.log --log-format=COMBINED -a -o /var/www/html/report.html --real-time-html
You can as well monitor logs on a remote server without having to install GoAccess on those servers via SSH. For example, read remote Apache logs line by line and pass it to GoAccess;
ssh [email protected] 'while IFS= read -r line; do echo "$line" && sleep 1 ; done < /root/access.log' | goaccess --log-format=COMBINED -a -o /var/www/html/remote.html --real-time-html -
The report for the remote server is then available under http://<server-IP>/remote.html.
Well that is just it on how to install GoAccess on Ubuntu 18.04/Debian 10 Buster. To learn more about GoAccess, read the GoAccess manual page, https://goaccess.io/man.
Install GoAccess on Ubuntu 18.04/Debian 10 Buster