This page looks best with JavaScript enabled

GoAccess

 ·  🎃 kr0m

GoAccess is a web server log analysis tool that can run both in the terminal and through a web server. GoAccess provides us with real-time detailed information about network traffic, web browsers, geolocation, and other interesting information for the system administrator.

GoAccess can generate an HTML file to view the statistics, but the best way to serve this information is through a mini web server like http-server-with-auth . When we want to access the information, we start the server and when we finish, we turn it off. Additionally, this server supports authentication, so it fits perfectly with our needs.

Depending on the operating system we use, the process may vary slightly.

pkg install npm
emerge -av net-libs/nodejs

Instalamos el servidor de forma global:

npm install http-server-with-auth -g

Instalamos GoAccess.

pkg install goaccess
emerge -av net-analyzer/goaccess

Creamos el directorio donde generar el html:

mkdir /root/goaccess
cp /usr/local/etc/goaccess.conf .goaccessrc

vi .goaccessrc

time-format %H:%M:%S
date-format %d/%b/%Y
log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u"
goaccess /var/log/nginx/access.log -o /root/goaccess/index.html --real-time-html

We start the web server to serve the file generated by GoAccess:

http-server-with-auth /root/goaccess/ --username “Admin” --password “PASSWORD” -p 7777

By accessing SERVER_IP:7777 and providing the credentials, we can view the statistics:

When we finish, we stop both GoAccess and the web server.

It is also possible to view the statistics via the terminal, but the web interface is more visually appealing.

goaccess /var/log/nginx/access.log

If you liked the article, you can treat me to a RedBull here