GoAccess – Linux system web real-time log analysis and statistics tool

888u

Last update at :2024-07-10,Edit by888u

A few days ago, Snail saw GoAccess, a relatively powerful log analysis tool, shared in the blogs of Jun Ge and Xiaoye. It is indeed a good tool for Linux VPS in terms of functionality and user experience of relational data. /Tools used in the server to analyze and compile website logs and user data. Just like many large websites, we rarely see them using website statistics tools. They usually analyze users and various information data through logs.

GoAccess, this log analysis tool can be used for Linux systems. It can be used for server log processing such as Nginx and Apache. It can also be used on Windows systems using Cygwin. Generally speaking, we use Linux systems more, so Snail is also ready to experience the differences of this log analysis tool.

According to the official introduction of GoAccess (https://www.goaccess.io), this log analysis tool can feedback data in real time, and can output pages in HTML format for our convenience; it can use almost all logs In the format, the required data can be counted in a friendly manner, such as access profiles, visitor rankings, dynamic and static page requests, operating systems, browsers used by visitors, domain names, etc. If we can use this tool well, we basically don’t need to use third-party website statistics tools, and the statistics will be more accurate.

First, GoAccess tool installation

Because I have only seen this tool before this article but have not actually used it, the test environment of this article is also on the test machine. The LNMP Web environment is used, mainly to experience the installation and basic application process of this tool.

Although the GoAccess tool supports yum or apt-get installation directly on the server, the directly compiled and installed version may not be the latest version, so Snail is prepared to use source compilation and installation.

1. Install dependent library software

A – CentOS

yum -y install glib2 glib2-devel GeoIP-devel ncurses-devel zlib zlib-devel

B – Debian/Ubuntu

apt-get -y install libncursesw5-dev libgeoip-dev libtokyocabinet-dev

2. Download the latest version of GoAccess and compile and install it

wget http://tar.goaccess.io/goaccess-1.0.2.tar.gztar -xzvf goaccess-1.0.2.tar.gzcd goaccess-1.0.2/./configure –enable-geoip –enable- utf8makemake install

The current version is 1.0.2. If we don’t like the trouble of installation, we can install it directly with yum or apt-get. There shouldn’t be much difference in function. Snail is just here to see what their latest version looks like. It is inevitable. There will be some differences.

3. Check whether the installation is correct

goaccess

After the installation is complete, enter the above command. If you can see the following prompt, it means that GoAccess is installed successfully.

Second, basic application of GoAccess tool

The installation of the GoAccess log analysis tool is very simple. In view of its relatively powerful functions, Snail (laozuo.org) allows you to simply experience the commonly used functions and operating methods for the first time. For detailed usage and functional applications, we can check the official website. case or go to GitHub to view specific documents (https://github.com/allinurl/goaccess).

1. View the log

goaccess -f laobuluo.com.log

You can view logs in this format, you can also use the URL LOG address with an absolute path, or you can go to the current log directory to correspond to separate log formats for different sites.

We need to select a format, confirm it with a space and press Enter (Common Log Format).

We can see statistics such as request page URL, user visitor data, etc.

2. Export HTML page

goaccess -f laobuluo.com.log –log-format=COMBINED -a > /home/wwwroot/laobuluo.com/report.html

There is an issue that needs to be noted here. If you are using the Nginx environment, you need to use the –log-format=COMBINED format, otherwise an error will be reported\\"Error occurred at: src/parser.c – parse_log\\". However, we can also modify the .goaccessrc file to solve the problem.

Through the HTML page (we need to set the export location ourselves, such as in the root directory of the current domain name), we can see the log analysis situation more intuitively. For example, request pages, request files, 404 pages, user IP statistics, user systems, browser usage, user domain names, etc. are basically not much different from website statistics tools.

Icon function demonstration: http://rt.goaccess.io/?20160918205156

Here we can take a look at the official online demonstration icon function. If we set up our website to generate HTML regularly, we can achieve real-time statistical data and the website does not need to install statistical tools.

To summarize, the GoAccess log analysis tool has many functions. It can be broken down to count the access status of a certain IP user on a certain day, it can also count the statistics of a certain time period, and it can also export CSV tables for summary analysis.

Recommended site searches: Hong Kong IP proxy, godaddy domain name resolution, US server defense, US virtual space, US virtual host purchase Ministry of Industry and Information Technology registration website, Hong Kong free virtual host Taobao virtual host, IP view, registration number,

GoAccess – Linux system web real-time log analysis and statistics tool

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码