Install GoAccess Log Analysis tool on Rocky Linux 9 Rumi, January 18, 2025January 18, 2025 Perform a system update Before installing any packages on the CentOS server instance, it is recommended to update the system. Log in using the sudo user and run the following commands to update the system. sudo yum -y install epel-release sudo yum -y update sudo shutdown -r now Once the system has finished rebooting, log in again as the sudo user and proceed to the next step. Install dependencies GoAccess is written in the C programming language. Hence, the only required dependency is the ncurses library and gcc. To install the ncurses and gcc, run: sudo yum -y install ncurses-devel gcc Importing the Remi PHP Repository for Rocky Linux 9 To kick things off, we must activate the CRB. This is achieved through the following command: sudo dnf config-manager --set-enabled crb Having activated the Code Ready Builder (CRB), it’s time to install both versions of the Extra Packages for Enterprise Linux (EPEL) repository. Let’s do that with this command: sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm With EPEL installed, we can now add the Remi repository for Enterprise Linux 9 to our system by executing the following command: sudo dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-9.rpm -y Install dependencies (tokyocabinet) dnf --enablerepo=crb install tokyocabinet-devel Install dependencies (GeoIP) dnf --enablerepo=remi install GeoIP-devel Install GoAccess. It is available in the default CentOS repositories. Install it using the following command: sudo dnf install goaccess -y After the installation, you can check the version of GoAccess to ensure it was successfully installed: goaccess --version Using GoAccess GoAccess is a web log analyzer. If you do not have a web server running, install the Apache web server. sudo yum -y install httpd Start and enable the web server to run at boot time. sudo systemctl start httpd sudo systemctl enable httpd Allow the required HTTP port through the system firewall. sudo firewall-cmd --add-service=http --permanent sudo firewall-cmd --reload Now you can access the web server using http://Vultr_Server_IP. Upon accessing the web page, Apache will add some log entries in the default access_log file. The path to the log file on CentOS 7 is /var/log/httpd/access_log. To analyze the log using GoAccess from a terminal, type: sudo goaccess /var/log/httpd/access_log --log-format=COMBINED The program will show you the generated report after analyzing the log file. An example report looks like the one shown below. Dashboard - Overall Analyzed Requests (29/Jun/2017 - 29/Jun/2017) [Active Panel: Visitors] Total Requests 16 Unique Visitors 1 Unique Files 1 Referrers 0 Valid Requests 16 Init. Proc. Time 0s Static Files 4 Log Size 3.92 KiB Failed Requests 0 Excl. IP Hits 0 Unique 404 6 Bandwidth 41.82 KiB Log Source /var/log/httpd/access_log > 1 - Unique visitors per day - Including spiders Total: 1/1 Hits h% Vis. v% Bandwidth Data ---- ------- ---- ------- ----------- ---- 16 100.00% 1 100.00% 41.82 KiB 29/Jun/2017 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 2 - Requested Files (URLs) Total: 1/1 Hits h% Vis. v% Bandwidth Mtd Proto Data ---- ------- ---- ----- ----------- --- -------- ---- 2 100.00% 0 0.00% 9.56 KiB GET HTTP/1.1 / 3 - Static Requests Total: 4/4 Hits h% Vis. v% Bandwidth Mtd Proto Data ---- ------ ---- ------ ----------- --- -------- ---- [?] Help [Enter] Exp. Panel 0 - Thu Jun 29 10:20:31 2017 [Q]uit GoAccess 1.2 To generate an HTML report, type: sudo goaccess /var/log/httpd/access_log --log-format=COMBINED -a -o /var/www/html/report.html Open your web browser and navigate to the URL http://Server_IP/report.html using your favorite web browser. The browser will show you many types of statistics using interactive graphs. Ref: https://linuxcapable.com/how-to-install-remi-rpm-on-rocky-linux/ https://rockylinux.pkgs.org/9/rockylinux-crb-x86_64/tokyocabinet-devel-1.4.48-19.el9.x86_64.rpm.html https://rhel.pkgs.org/9/remi-x86_64/GeoIP-devel-1.6.12-9.el9.remi.x86_64.rpm.html https://docs.vultr.com/how-to-install-goaccess-on-centos-7 https://reintech.io/blog/install-use-goaccess-real-time-web-log-analysis-centos-9 Administrations Configurations (Linux) goaccessRockyRocky 8Rocky 9