What is Goaccess?
Goaccess is an open source, real-time, Web log analysis tool that runs under the command line terminal. The tool provides fast and varied HTTP status statistics, so administrators can no longer dwell on statistics and miscellaneous instructions and a whole bunch of plumbing/regular expressions.
goaccess Features at a glance
Generate statistical data, bandwidth statistics, etc.
Time statistics for each request
Highest Access IP
Requested file statistics
requested static files, pictures, Flash, JS files, etc.
Each HTTP status Code statistic
Hosts, Reverse Dns,ip location
Operating system
Browser/Spider
References to Web sites
URLs to quote
Key phrases
Location (mainland, country, city)
Can output JSON or CSV
A variety of color themes
Continuous analysis supporting high-volume data and supporting high-volume data
Support IPV6
HTML reports can be generated
Start using
If you want to compile from source:
wget HTTP://TAR.GOACCESS.IO/GOACCESS-0.8.1.TAR.GZTAR-XZVF GOACCESS-0.8.1.TAR.GZCD Goaccess-0.8.1/./configure-- Enable-geoip--enable-utf8make && make install
Or
Yum Install-y goaccess
Use Access to analyze Nginx logs
Then you can start using the goaccess.
First, enter the Nginx log directory, such as/var/log/nginx, enter the following command to let goaccess open the specified file:
Goaccess-f Access.log
After opening, you will jump out of the selection log file type interface:
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M01/7D/39/wKiom1bikYrChUjsAAEI2Gmb3xE192.jpg "title=" 1.jpg " alt= "Wkiom1bikyrchujsaaei2gmb3xe192.jpg"/>
The Nginx log is of type combined log Format (xlf/elf), so we choose the third one. Use the upper and lower cursor to move, the space is selected, enter OK.
Enter the main interface:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/7D/39/wKiom1bikeWDiad9AABdNV5DHiU422.jpg "title=" 2.jpg " alt= "Wkiom1bikewdiad9aabdnv5dhiu422.jpg"/>
Keyboard operation:
F1
or h
: Help
F5
: Refresh the main interface
q
: Exit program/Current window/collapse Current module
o
or Enter
: Expand the selected module or window
-
0-9
and shift + 0
: Activates the selected module or window
k
and j
: module internal movement
c
: Modify Color
-
^f
and ^b
: Scroll up and down in the module
tab
shift+tab
: Front and rear switch module
s
: module Internal sorting selection
/
: Search in all modules (support regular)
n
: Find the next match
g
and G
: Jump to First/last item
Command-line Related:
Before using the goaccess command line, we must configure the parsing format of the log file, because there is no interface here to let you choose the log format.
Check the log format:
220.171.104.18--[11/mar/2016:17:20:07 +0800] "get/templets/smore/images/top.png http/1.1" 304 0 "http://www.test.cn/ Lines/show_4.html "" mozilla/5.0 (Windows NT 6.1) applewebkit/537.36 (khtml, like Gecko) chrome/45.0.2454.101 safari/ 537.36 "
Now modify the configuration file to add:
vi/etc/goaccess.conf time-format%tdate-format%d/%b/%ylog-format%h%^[%d:%t%^] "%r"%s%b "%r" "%u"
To implement log analysis in real time, run the following command:
Goaccess-f/var/log/nginx/access.log
If you want to see one day, you can print an HTML report:
goaccess-d-f/var/log/nginx/access.log-a >report.html
Because Nginx will automatically compress the log, the command can directly analyze the compressed log:
Zcat access.log.*.gz | goaccess# or zcat-f access.log* | Goaccess
Reference Links:
https://www.fancycoding.com/log-analyse-using-goaccess/
Http://www.mamicode.com/info-detail-923728.html
Http://www.cnblogs.com/yjf512/p/3640346.html
Using goaccess to analyze Nginx logs