Introducción
GoAccess es un analizador de logs web en tiempo real. Puede mostrar estadísticas en terminal o generar informes HTML, JSON y CSV.
Instalar en RHEL/CentOS 8 desde código fuente
dnf -y install epel-release
dnf -y update
dnf -y install ncurses-devel gcc
dnf -y install geoip-devel tokyocabinet-devel
dnf install -y autoconf gettextwget https://tar.goaccess.io/goaccess-1.5.1.tar.gz
tar -xzvf goaccess-1.5.1.tar.gz
cd goaccess-1.5.1/
./configure --enable-utf8
make
make installInstalar desde GitHub
git clone https://github.com/allinurl/goaccess.git
cd goaccess
autoreconf -fi
./configure --enable-utf8 --enable-geoip=mmdb
make
make installOtras distribuciones
Fedora: yum install goaccess
Arch: pacman -S goaccess
Gentoo: emerge net-analyzer/goaccess
macOS: brew install goaccess
FreeBSD: pkg install sysutils/goaccess
OpenBSD: pkg_add goaccess
openSUSE: zypper install goaccessUsar GoAccess en terminal
goaccess -f /var/log/httpd/access_logSelecciona el formato de log. Para Apache suele ser COMBINED.
También puedes indicarlo directamente:
goaccess /var/log/httpd/access_log --log-format=COMBINEDPulsa q para salir.
Generar informe HTML
goaccess /var/log/httpd/access_log --log-format=COMBINED -a -o /var/www/html/report.htmlAbre https://IP_DEL_SERVIDOR/report.html.
Actualizar informe con cron
vim /mnt/goaccess.sh#!/bin/bash
goaccess /var/log/httpd/access_log --log-format=COMBINED -a -o /var/www/html/report.htmlcrontab -eAñade:
* * * * * /mnt/goaccess.shConclusión
GoAccess permite visualizar registros web de forma rápida desde terminal o mediante un panel HTML actualizado.