1. Introduction
Goaccess is a tool used to count the access logs of Apache WEB servers to generate statistical reports instantly, very quickly
The statistics that are viewed are:
Statistics overview, traffic consumption and other visitors rank Dynamic Web requests for static Web requests, slices, stylesheets, scripts, and so on. Routing domain 404 error operating system browser and search engine host, DNS and IP address HTTP response Code referral Web site keyboard layout custom display supports oversize log
2. Installation
Yum-y Install glib2 glib2-devel ncurses ncurses-devel GeoIP geoip-develwget http://tar.goaccess.io/ GOACCESS-0.9.3.TAR.GZTAR-XZVF GOACCESS-0.9.3.TAR.GZCD goaccess-0.9.3/./configure--enable-geoip-- Enable-utf8makemake Install
Configure
Multiple options can used to configure Goaccess. For a complete up-to-date list of configure options, run./configure--help--enable-debug Compile with debugging SYMB OLS and turn off compiler Optimizations.--enable-utf8 Compile with wide character support. NCURSESW is Required.--enable-geoip Compile with geolocation support. MaxMind ' s GeoIP is required.--enable-tcb=<memhash|btree> Compile with Tokyo Cabinet storage support. Memhash Would utilize Tokyo Cabinet ' s on-memory hash database. Btree would utilize Tokyo Cabinet ' s on-disk B + Tree Database.--disable-zlib disable zlib compression on B + Tree Databas E.--disable-bzip
Goaccess Dependencies
distro |
ncurses |
GLib >= 2.0.0 |
GeoIP (optional) |
Tokyo Cabinet (optional) |
ubuntu/debian |
libncursesw5-dev |
libglib 2.0-dev |
libgeoip-dev |
libtokyocabinet-dev |
fedora/rhel/cento S |
ncurses-devel |
glib2-devel |
geoip-devel |
tokyocabinet-devel |
arch Linux |
ncurses |
glib2 |
geoip |
compile from Sourc E |
gentoo |
sys-libs/ncurses |
dev-libs/glib:2 |
dev- Libs/geoip |
dev-db/tokyocabinet |
3. Usage
-f– log file name-b– turn on traffic statistics, if you want to speed up the analysis is not recommended to use this parameter-s– turn on HTTP response Code statistics-a– turn on user agent statistics-e– turn on the specified IP address statistics, disabled by default
For example
1. See how many IP accesses are available on the day: awk ' {print $ ' log_file|sort|uniq|wc-l2, viewing the number of times a page has been accessed: grep "/index.php" Log_file | WC-L3, see how many pages each IP visited: awk ' {++s[$1]} end {for (a in S) print A,s[a]} ' log_file4, the number of pages accessed per IP from small to large: awk ' {++s[$1]} end {F Or (A in S) print S[a],a} ' log_file | SORT-N5, see which pages an IP has accessed: grep ^111.111.111.111 log_file| awk ' {print $1,$7} ' 6, remove page from search engine statistics Day: awk ' {print $12,$1} ' log_file | grep ^\ "Mozilla | awk ' {print $} ' |sort | Uniq | WC-L7, see June 21, 2009 14 O'Clock How many IP accesses are in this one-hour period: awk ' {print $4,$1} ' log_file | grep 21/jun/2009:14 | awk ' {print $} ' | Sort | Uniq |
Goaccess
# goaccess-f/var/log/httpd/access_log exclude statistic a source ip# goaccess-e 123.123.123.123-f/var/log/httpd/access_ Log to view host details when displaying user-agents information from the host # Goaccess-a-f/var/log/httpd/access_log generating HTML report (static report) # Goaccess-a-f/var/ Log/httpd/access_log > Result.html only count records from an IP # grep ^123.123.123.123/var/log/httpd/access_log | Goaccess
Keyboard operation
F1 or H: Help F5: Refresh main interface Q: Exit program/Current window/collapse current module O or enter: Expand the selected module or window 0-9 and SHIFT + 0: Activate the selected module or Window K and J: Move inside the module C: Modify the color palette ^f and ^b: Scroll up and down in the Module tab Shift+tab: Front and rear switch module S: module internal sort selection/: Search in all modules (support Regular) N: Find next match G and G: Skip to First/last item
Generate HTML
Goaccess-f/var/log/apache2/access.log-a > report.html
Reference address
http://www.goaccess.io/
The goaccess of Nginx log Analysis weapon