GoAccess#

last update 2025/02/05

console#

../../_images/goacc.png

summary#

GoAccess is an open source real-time web log analyzer.


environment#

environment#

OS

WebServer

AlmaLinux 9

Apache2.4


install#

dnf -y install goaccess ncurses-devel mod_maxminddb GeoIP*

configuration#

vi /etc/goaccess/goaccess.conf

time format#

time-format %H:%M:%S

date format#

date-format %d/%b/%Y

log format#

log-format COMBINED

Example of customized log format

log-format %h %l %e %^[%d:%t %^] "%r" %s %b "%R" "%u" "%O"

GeoIP#

geoip-database /usr/share/GeoIP/GeoLite2-City.mmdb

SSL certificates#

注釈

REquired for SSL access
ssl-cert /<cert file pass>
ssl-key /<key file pass>

make service file#

/etc/systemd/system/goaccess.service#
 1[Unit]
 2Description=Goaccess daemon.
 3After=network.target
 4
 5[Service]
 6Type=simple
 7User=root
 8Group=root
 9Restart=always
10ExecStart=/bin/goaccess -f /var/www/httpd/access_log -o /var/www/html/index.html --real-time-html
11StandardOutput=null
12StandardError=null
13
14[Install]
15WantedBy=multi-user.target

start process#

systemctl enable goaccess
systemctl start goaccess

Apache configuration#

<VirtualHost *:80>
    ServerName <Domain name to access GoAccess>
    DocumentRoot "/var/www/html"
</VirtualHost>

Open port of firewalld#

open tcp 80 and 7890 (also 443 when use SSL)

firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --zone=public --add-service=https --permanent
firewall-cmd --zone=public --add-port=7890/tcp --permanent
firewall-cmd --complete-reload

Usage#

by web browser#

access http://<Domain name to access GoAccess>

by command#

goaccess -f /var/www/httpd/access_log