Software Introduction
Goaccess is an open-source real-time website log analysis tool. Goaccess works by reading and parsing the access log files of servers such as Apache/Nginx/Lighttpd, displaying statistical information in an intuitive way, including access overview, dynamic page requests, static page requests, visitor rankings, visitors' operating systems, visitors' browsers, referring domains, 404 errors, search crawlers, search keywords, and more.
Goaccess not only displays information in different colors in the terminal, but can also output detailed charts for users' reference. It supports the analysis of server logs from Apache, Nginx, Amazon S3, Elastic Load Balancing, CloudFront, and more. It is not limited to LNMP; any of the log formats listed above can be used.
Installing Goaccess
Install the dependency packages, making sure to distinguish between your systems.
Ubuntu/Debian:
apt-get install libncursesw5-dev libgeoip-dev libtokyocabinet-dev
Fedora/RHEL/CentOS:
yum install ncurses-devel geoip-devel tokyocabinet-devel
Install Goaccess by executing the commands one by one in order.
wget http://tar.goaccess.io/goaccess-1.2.tar.gz
tar xzvf goaccess-1.2.tar.gz
cd goaccess-1.2/
./configure --enable-geoip --enable-utf8
make && make install
Usage
Generate a chart webpage.
goaccess -f /home/www.ikxin.com.log --log-format=COMBINED -a > /www/wp-xinye/web.html
/home/www.ikxin.com.log is the path to your log file.
/www/wp-xinye/web.html is the path to the page you want to generate.
This generates a very intuitive webpage chart that can be opened directly in a browser for viewing.
You can also use it with crontab to run it periodically and automatically generate charts.
Execute: crontab -e
Add one line:
50 23 * * * goaccess -f /home/www.ikxin.com.log --log-format=COMBINED -a > /www/wp-xinye/web.html
This indicates that a log webpage chart for the corresponding domain will be generated every day at 23:50. Below is one of my own charts.
