How to install GoAccess web log analyzer with Nginx on Linux or Unix
GoAccess is a real-time Apache/Nginx/Lighttpd web log analyzer and interactive viewer that runs in a terminal and provides fast and valuable HTTP statistics for system administrators that require a visual report on the fly. How do I install GoAccess on Ubuntu Linux server? How can I instal and use GoAccess on Linux or Unix-like system?
GoAccess is a free and open source real-time web log analyzer and interactive viewer that runs in a terminal in Linux/Unix/*BSD systems or through your browser. This tutorial shows how to install the GoAccess on Linux/Unix and how to use it on the *nix command line.
Install GoAccess
You must install GoAccess as per your Linux or Unix distro.
Install GoAccess on Ubuntu Linux
Type the following apt-get command/apt command as follows:$ sudo apt-get install goaccess
Sample outputs:
Install GoAccess on Debian Linux
Type the following apt-get command/apt command as follows:$ sudo apt-get install goaccess
Install GoAccess on Alpine Linux
Type the following apk command as follows:# apk add goaccess
Install GoAccess on CentOS Linux
First turn on the EPEL repo and type the following yum command as follows:$ sudo yum install epel-release
$ sudo yum install goaccess
Install GoAccess on Fedora Linux
First turn on the EPEL repo and type the following dnf command as follows:$ sudo dnf install epel-release
$ sudo dnf install goaccess
Install GoAccess on Arch Linux
Type the following pacman command as follows:# pacman -S goaccess
Install GoAccess on FreeBSD UNIX
To install the port:# cd /usr/ports/sysutils/goaccess/ && make install clean
OR To add the package:# pkg install goaccess
Install GoAccess on macOS UNIX (Homebrew)
Type the following brew command:$ brew install goaccess
Install GoAccess on OpenBSD UNIX
Type the following pkg_add command:$ doas pkg_add goaccess
Installing GoAccess using source code method
Type the following command to download and compile GoAccess on Unix-like system:$ cd /tmp
$ wget http://tar.goaccess.io/goaccess-1.2.tar.gz
$ tar -zxvf goaccess-1.2.tar.gz
$ cd goaccess-1.2/
$ ./configure --enable-utf8 --enable-geoip=legacy && make
$ sudo make install
How do I use GoAccess?
The syntax is:goaccess -f /path/to/nginx/access.log
goaccess -f /path/to/apache/access.log
goaccess -f /path/to/lighttpd/access.log
goaccess -f /path/to/lighttpd/access.log /path/to/lighttpd/access.log.1
zcat /path/to/nginx/access.log.*.gz | goaccess access.log -
goaccess [options] /path/to/lighttpd/access.log
Examples
Let us see some examples.
How can I see output on screen with a live report?
goaccess -f /var/log/nginx/access.log
You will be promoted to select “Log Format Configuration”:
Next you will see a report as follows:
IMPORTANT SHORTCUT KEYS
You can use the following keys:
- q – Quit the program.
- h or ? – See help.
- 0-9 and Shift + 0 – Set selected module to active.
- j – Scroll down within expanded module.
- k – Scroll up within expanded module.
- c – Set or change scheme color.
- ^f – Scroll forward one screen within active module.
- ^b – Scroll backward one screen within active module.
- TAB – Iterate modules (forward).
- SHIFT + TAB – Iterate modules (backward).
- s – Sort options for active module.
- /Search – across all modules (regex allowed).
- n – Find position of the next occurrence.
- g – Move to the first item or top of screen.
- G – move to the last item or bottom of screen.
How do I generate an HTML report?
The syntax is:goaccess -f /var/log/nginx/access.log --log-format=COMBINED -o www.nixcraft.com.log.html
Sample outputs:
Parsing... [669] [1112]
You can view report with your web-browser. Here is a sample report:https://www.cyberciti.biz/files/goaccess/www.nixcraft.com.log.html
How do I use goaccess over an ssh based session?
The syntax is:$ ssh vivek@server1.cyberciti.biz 'cat /var/log/nginx/access.log'|goaccess --log-format=COMBINED -a -
$ ssh vivek@server1.cyberciti.biz 'cat /var/log/nginx/access.log'|goaccess --log-format=COMBINED -
$ ssh vivek@server1.cyberciti.biz 'cat /var/log/nginx/access.log'|goaccess --log-format=COMBINED -o www.nixcraft.com.log.htm -
How do I view real time stats in browser?
Run it as follows:$ goaccess -f access.log -o report.html --real-time-html --addr=192.168.1.254 --port=8022
or
goaccess -f /var/log/nginx/access.log –log-format=COMBINED -o /usr/local/www/nginx/report.html –real-time-html –addr=10.100.100.1
Source : https://www.cyberciti.biz/faq/how-to-install-goaccess-web-log-analyzer-with-nginx-on-linux-or-unix/
Posted on: June 26, 2019, by : Julian's | 26 views