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)
First, install Homebrew on macOS and then 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”:
Fig.02: Set the log-format for your log file
Fig.03: See an interactive report on screen
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
Further readings:
- 7 Awesome Open Source Analytics Software For Linux and Unix-like Systems
- See man page or project page for more info.
🐧 0 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |