Hello, friends. In this post, you will learn how to install GoAccess on Ubuntu 20.04 / Debian 10. This way you will be able to monitor your web server without problems.
What is it?
According to the project’s website,
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.
Also, “It provides fast and valuable HTTP statistics for system administrators that require a visual server report on the fly”.
Some features are:
- Fast, real-time, millisecond/second updates, written in C
- Only ncurses as a dependency
- Nearly all web log formats (Apache, Nginx, Amazon S3, Elastic Load Balancing, CloudFront, etc)
- Simply set the log format and run it against your log
- Beautiful terminal and bootstrap dashboards (Tailor GoAccess to suit your own color taste/schemes)
- and of course, Valgrind tested.
Installing GoAccess on Ubuntu 20.04 / Debian 10
GoAccess is available in the official Ubuntu repositories, so the installation is quite simple but it is convenient to have the latest version available. So, you have to add the GoAccess repository.
To do this, open a terminal and execute the following commands:
echo "deb http://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/goaccess.list
wget -O - https://deb.goaccess.io/gnugpg.key | sudo apt-key --keyring /etc/apt/trusted.gpg.d/goaccess.gpg add -
Now refresh the APT cache:
sudo apt update
And performs the installation running:
sudo apt install goaccess Reading package lists… Done Building dependency tree Reading state information… Done The following additional packages will be installed: libmaxminddb0 libncursesw5 libtinfo5 Suggested packages: mmdb-bin Recommended packages: libgpm2 The following NEW packages will be installed: goaccess libmaxminddb0 libncursesw5 libtinfo5 0 upgraded, 4 newly installed, 0 to remove and 28 not upgraded. Need to get 833 kB of archives. After this operation, 2,025 kB of additional disk space will be used. Do you want to continue? [Y/n]
If you want, you ca check the installed version:
goaccess --version GoAccess - 1.4.6. For more details visit: https://goaccess.io/ Copyright (C) 2009-2020 by Gerardo Orellana And so you can get GoAccess, now let's use it a little.
Using GoAccess on Ubuntu 20.04 / Debian 10
The first thing you can do is check the help that the terminal gives us, for that you can run:
On the other hand, the most basic way to use goaccess is simply by specifying a log file.
Or you can select the log of your Virtualhost.
There you will be shown a screen in the terminal where you can choose the log output format.
In my case, I have chosen the third option (CLF).
And immediately it will start the analysis.
Note: I am working with a home test server. Therefore, there is not so much activity in the log.
But you can also specify a log format to make it work with, for example, squid. Although we recommend that you read the official documentation
A very interesting option is to display it directly on your web browser. I think this is the best possible option.
sudo goaccess /var/log/apache2/access.log --log-format=COMBINED -a -o /var/www/html/file.html
And this will generate a file that you can open from the browser. Remember to modify the name of the output file.
And this is the basic use of GoAccess as we see is a basic but very useful tool.
Having a program that can analyze logs graphically and interactively is an advantage for all of us who work on Linux. That’s why today we wanted to show you GoAccess.