Using goaccess to analyze Nginx logs

Source: Internet
Author: User
Tags geoip maxmind

First, the need to install LNMP, has been installed to complete, in order to test the effect I put my own site can be tested. If you do not know how to install LNMP can refer to the shell script with a key to build LNMP environment in the actual combat test the effect I built

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/73/8B/wKiom1YA1mSRamCrAAFygP-ucZo444.jpg "title=" QQ picture 20150922121626.png "alt=" Wkiom1ya1msramcraafygp-uczo444.jpg "/>

Service has been restarted, then test my site can be normal access, because it is built on the local virtual machine, with the domain name access so need to define in the Hosts file, the Windows Hosts file path is: C:\Windows\System32\drivers\ The Hosts file for etc Linux is/etc/hosts

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/73/89/wKioL1YA3XmSvPevAAGntaDay_s662.jpg "title=" QQ picture 20150922123702.png "alt=" Wkiol1ya3xmsvpevaagntaday_s662.jpg "/>

To this site has been built to complete, then we see is installed goaccess

First step: Install basic software glib2 glib2-devel ncurses ncurses-devel GeoIP geoip-devel It is not easy to find these two software GeoIP geoip-devel when installing with Yum here. Therefore, you need to download the installation separately.

[Email protected] ~]# yum-y install glib2 glib2-devel ncurses ncurses-devel

Installing Geo-ip and GeoIP

[Email protected] ~]# cd/usr/local/src/[[email protected] src]# wget http://geolite.maxmind.com/download/geoip/api/c /geoip-1.4.6.tar.gz[[email protected] src]# wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry /geoip.dat.gz

Download path for two files

Installing the GeoIP Library

[Email protected] src]# TAR-ZXF geoip-1.4.6.tar.gz [[email protected] src]# CD Geoip-1.4.6[[email protected] GeoIP-1.4.6 ]#./configure

[[email protected] geoip-1.4.6]# make & make Install

[Email protected] geoip-1.4.6]# CD. [Email protected] src]# MV geoip.dat.gz/usr/local/share/geoip/

Step Two: Install Goaccess

[Email protected] src]# wget http://jaist.dl.sourceforge.net/project/goaccess/0.6.1/goaccess-0.6.1.tar.gz[[email Protected] src]# tar-zxf goaccess-0.6.1.tar.gz [[email protected] src]# CD Goaccess-0.6.1[[email protected] goaccess-0.6 .1]#./configure–enable-geoip–enable-f8 [[email protected] goaccess-0.6.1]# make && make install

Installation is complete.

The third step: Set goaccess, real-time dynamic display.

[Email protected] ~]#/usr/local/bin/goaccess-f/home/wwwlogs/access.log

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/73/8B/wKiom1YA4ViBZiSpAAMxLzdBqFQ967.jpg "title=" QQ picture 20150922130223.png "alt=" Wkiom1ya4vibzispaamxlzdbqfq967.jpg "/>

Enter to see the real-time information of nginx log in real time.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/73/89/wKioL1YA5ZbTyEf3AAfdZukPwjA575.jpg "title=" QQ picture 20150922130437.png "alt=" Wkiol1ya5zbtyef3aafdzukpwja575.jpg "/>

You can see the file path of the Web site

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/73/8B/wKiom1YA43PwBD9zAAiNt-5Q7nc628.jpg "title=" QQ picture 20150922130904.png "alt=" Wkiom1ya43pwbd9zaaint-5q7nc628.jpg "/>

You can see traces of your browsing.

If you need to look at a day's log can be used, such as October 1, 2015

Sed-n '/01/dec/2015/,$ p ' access.log | Goaccess-s-B

A time period with

Sed-n '/1/nov/2015/,/5/dec/2015/p ' Access.log | Goaccess-s-B

Analyze logs on the server by calling local goaccess

SSH [email protected] ' Cat/var/log/nginx/access.log ' | Goaccess-s-a-b

Fourth step: goaccess Generate Files

Goaccess-f/www/wwwlogs/nginx.log-a > report.html

The diagram after the last export

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/73/9E/wKioL1YCawqyUBO2AAiFmP3xv7s430.jpg "title=" QQ picture 20150923165825.png "alt=" Wkiol1ycawqyubo2aaifmp3xv7s430.jpg "/>

This article is from the "Wu-Dick" blog, please be sure to keep this source http://9827789.blog.51cto.com/9817789/1697528

Using goaccess to analyze Nginx logs

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.