Linux GoAccess Web real-time log analysis and statistical tools

Source: Internet
Author: User
Tags geoip html page

A few days ago, the old man saw the powerful log analysis tool GoAccess in the blog of June and Xiaoye, it is a good tool for analyzing and counting website logs and user data in Linux VPS/server. Just like many large websites, we seldom see Website statistics tools, which generally analyze users and various information data through logs.

GoAccess, a log analysis tool for Linux systems, can be used in Nginx, Apache, and other server log processing, or Cygwin can be used in Windows systems. Generally, we use more Linux systems, so old Zuo is also ready to experience what is the difference between this log analysis tool.

According to the GoAccess official (https://www.goaccess.io) introduction, this log analysis tool can feedback data in real time, and can output HTML format pages for us to check; it can be used in almost all log formats. It can easily collect statistics on the required data, for example, the access overview, visitor ranking, dynamic and static page requests, guest operating systems, browsers, and origin domain names can all be counted. If we can use this tool well, we basically don't need to use third-party website statistics tools, and the statistics are more accurate.

1. Install the GoAccess tool

Because this tool has not been used before, the testing environment of this article is also in the testing machine. The LNMP Web environment is used to experience the installation and basic application processes of this tool.
Although the GoAccess tool supports direct installation of yum or apt-get on the server, the latest version may not be directly compiled and installed.

1. Install dependency library software

A-CentOS
Yum-y install glib2 glib2-devel GeoIP-devel ncurses-devel 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.gz
Tar-xzvf goaccess-1.0.2.tar.gz
Cd goaccess-1.0.2/
./Configure -- enable-geoip -- enable-utf8
Make
Make install
The current version is 1.0.2. If we do not want to install it in this way, we can directly install yum or apt-get. There should be no major functional differences, the old ones only look at their latest version, which is a little different.

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 indicates that GoAccess is successfully installed.

 

2. Basic application of the GoAccess tool

The installation of the GoAccess log analysis tool is still very simple. In view of its powerful functions, laozuo.org (laozuo.org) has a simple experience of common functions and operation methods for the first time, for detailed usage and functional applications, we can refer to the cases provided on the official website or go to GitHub to view the specific documentation (https://github.com/allinurl/goaccess ).
1. View Logs


Goaccess-f laobuluo.com. log

In this format, you can view the LOG, use the url log address of the absolute path, or go to the current LOG Directory, corresponding to the separate LOG format of different sites.

 


We need to select a Format, use a space to determine and then press Enter (Common Log Format ).
View Logs
We can see statistics such as the request page URL and user visitor data.

2. Export the HTML page

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

Note one problem here. If The Nginx environment is used, you must use the -- log-format = COMBINED format. The Error occured at: src/parser will not be reported. c-parse_log ". However, you can modify the. goaccessrc file to solve the problem.

 

Through the HTML page (we need to set the export location, for example, under the root directory of the current domain name), we can see the log analysis more intuitively. Such as request pages, request files, 404 pages, user IP statistics, user systems, browser usage, user-initiated domain names, etc., are basically the same as website statistics tools.

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

Here we can look at the official online demo icon function. If we set regular HTML generation for our website, real-time statistics can be achieved, and the website does not need to install statistical tools.
To sum up, the GoAccess log analysis tool has many other functions, which can be subdivided into statistics on the access status of a certain IP user on a specific day or a specific period of time, you can also export CSV tables for sorting, summary, and analysis.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.