Astats Log Analysis System

Source: Internet
Author: User

Awstats is a free, very concise and powerful website log analysis tool.

Features: Number of visits, number of visits, page views, clicks, data traffic, etc. two: accurate to monthly, daily, hourly data three: Visitor Country four: visitor IP five: robots/spiders statistics Six: Visitor Duration VII: to different files type Statistics Eight: Pages-url statistics IX: Guest OS browser Information 10: Other information (search keywords, etc.) 1. Install httpd
[Email protected]/]# tar zxvf httpd-2.2. tar.gz-c/usr/src//]# unzip awstats-7.0/]#./configure--prefix=/usr/local/ httpd--enable-so--enable-rewrite--enable-charset-lite--enable-cgi && make && make install
    • --prefix: Specifying the installation directory
    • --ENABLE-SO: Enable dynamic load module support
    • --enable-rewrite: Enable site rewriting features
    • --enable-charset-lite: Startup Character Set support
    • --ENABLE-CGI: Enable CGI scripting support
      [Email protected] httpd-2.2. +] # ln-s/usr/local/httpd/bin/*  /usr/local/bin/            //optimize execution path [[email protected] ~]# Cp/usr/local/httpd/bin /APACHECTL/ETC/INIT.D/HTTPD
[Email protected] ~]# vim/etc/init.d/httpd#chkconfig:35 15#description:apache HTTP Server

 [[email protected] ~]# chkconfig--add httpd [r[email protected]  ~]# chkconfig--level 35   httpd on[[email  Protected]  ~]# vim/usr/local/httpd/conf/httpd.confservername www.aaa.com:   80  //  add site domain name  [[email protected] ~]# httpd–t // Check for configuration file error  syntax ok[[email protected]  ~]#/etc/init.d/httpd Start 
 the TCP         0      0 ::: +                       :::*                        LISTEN      54881/~]# elinks http://  192.168.1.200It works!

Create a virtual Web host based on a different domain name

Create a document directory for a Web site for two sites

[Email protected] ~]# mkdir/usr/local/httpd/htdocs/Aaacom[[email protected]~]# mkdir/usr/local/httpd/htdocs/Bbbcom[[email protected]~]# Echo''>/usr/local/httpd/htdocs/aaacom/Index.html[[email protected]~]# Echo''>/usr/local/httpd/htdocs/bbbcom/index.html Modifying configuration Files httpd.conf and httpd-Vhosts.conf[[email protected]~]# cd/usr/local/httpd/conf/extra/[email protected] extra]# vim httpd-Vhosts.confnamevirtualhost192.168.1.200: the<virtualhost192.168.1.200: the>DocumentRoot"/usr/local/httpd/htdocs/aaacom/"ServerName www.aaa.com errorlog"Logs/www.aaa.com-error_log"Customlog"Logs/www.aaa.com-access_log"Common</virtualhost><virtualhost192.168.1.200: the>DocumentRoot"/usr/local/httpd/htdocs/bbbcom/"ServerName www.bbb.com errorlog"Logs/www.bbb.com-error_log"Customlog"Logs/www.bbb.com-access_log"Common</VirtualHost>[email protected] extra]# CD. [Email protected] conf]# vim httpd.confinclude conf/extra/httpd-vhosts.conf//remove the "#" in front of this line[Email protected] ~]# vim/etc/hosts192.168.1.200www.aaa.com Www.bbb.com[[email protected]~]#/etc/init.d/httpd restart[[email protected]~]# elinks http://www.aaa.comWww.aaa.com[[email protected]~]# elinks http://www.bbb.comWww.bbb.com

Two

Deploying and installing the Awstats Log Analysis system

[Email protected]/]# unzip awstats-7.0/]# mv awstats-7.0 /usr/local//]# cd/usr/ local/awstats/tools/[[email protected] tools]#. /awstats_configure.pl
-----AWStats Awstats_configure 1.0 (Build 1.9) (c) Laurent destailleur-----This tool would help you to configure AWStats To analyze Statistics Forone Web server. You can-try to-use it-let it does all that's Possiblein AWStats Setup, however following the step by step manual setupdo Cumentation (docs/index.html) is often a better idea. Above all if:-You is not a administrator user,-you want to analyze downloaded log files without web server,-you want  To analyze mail or FTP log files instead of the Web log files,-you need to analyze load balanced servers log files,-you want To ' understand ' all possible ways-to-use AWStats ... Read the AWStats documentation (docs/index.html).-----> Running OS detected:linux, BSD or Unix-----> Check for Web Server installenter full config file path of your WEB server. Example:/etc/httpd/httpd.confexample:/usr/local/apache2/conf/httpd.confexample:c:\program files\apache group\ Apache\conf\httpd.confconfig file path (' None ' to skip Web server Setup):>/usr/local/httpd/conf/httpd.conf//httpd Master profile Path-----> Check and complete Web server config file '/usr/local/ httpd/conf/httpd.conf ' warning:you Apache config file contains directives to write ' common ' log filesthis means that some Features can ' t work (OS, browsers and keywords detection). Do you want me to setup Apache to write ' combined ' log files [y/n]? y//Setting the log file type Add ' alias/awstatsclasses "/usr/local/awstats/wwwroot/classes/" ' Add ' alias/awstatscss "/usr/local/ awstats/wwwroot/css/"' Add ' alias/awstatsicons"/usr/local/awstats/wwwroot/icon/"' Add ' scriptalias/awstats/"/usr/ local/awstats/wwwroot/cgi-bin/"' Add ' <Directory> ' directive awstats directives added to Apache config file.-----& Gt Update model config file '/usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf ' file awstats.model.conf Updated.-----> need to create a new config file? Do you want me to build a new AWStats config/profilefile (required if first install) [y/n]? y//Setting the site profile-----> DEfine config file name to Createwhat are the name of the your Web site or profile analysis? Example:www.mysite.comExample:demoYour Web site, virtual server or profile name:> www.aaa.com//the site name of the statistic next to default configuration press ENTER

Modifying the awstats.www.aaa.com.conf configuration file

[Email protected] ~]# mkdir/var/lib/~]# vim/etc/awstats/awstats.www.aaa.com.conf
Logfile= "/usr/local/httpd/logs/access_log" Dirdata= "/var/lib/awstats"

Create a storage directory for the database and update the database

[Email protected] ~]#/usr/local/awstats/tools/awstats_updateall.pl now//Execute update script running ' "/usr/local/awstats/wwwroot /cgi-bin/awstats.pl "-update-config=www.aaa.com-configdir="/etc/awstats "to update config www.aaa.comCreate/Update Database for config '/etc/awstats/awstats.www.aaa.com.conf ' by Awstats version 7.0 (build 1.971) from the data in log file "/us R/local/httpd/logs/access_log "... Phase 1:first bypass old records, searching new record ... Searching new records from beginning of log file ... Jumped lines in file:0parsed lines in File:2 Found 0 dropped records, Found 0 comments, Found 0 Blank Records, Found 2 C Orrupted Records, Found 0 old records,  Found 0 new qualified records.

Create Recurring Scheduled Tasks

[Email protected] ~]# crontab-e* *5 * * * * */usr/local/awstats/tools/awstats_updateall.pl now

Create a site Jump page

[[Email protected]/] vim aws.html" 0; Url=http://www.aaa.com/awstats/awstats.pl?config=www.aaa.com ">/]# mv aws.html/usr/local/httpd/htdocs/        // Move the jump page to the root of the site [ [Email protected] ~]#/etc/init.d/httpd Restart restart Apache visit Awstats home

Control for access to the Awsstats

Client Address Restrictions

[Email protected]/]# vim/usr/local/httpd/conf/httpd.conf"/usr/local/awstats/wwwroot ">    Options none    allowoverride none    Order deny,allow    from  192.168. 1.234                // deny host access to IP 192.168.1.234 </Directory>/]#/etc/init.d/httpd Restart

At this point the 192.168.1.234 client will not be able to access www.aaa.com/aws.html

User Identity authentication Restrictions

First use the HTPASSWD tool to create a user authentication data file

[Email protected]/]# htpasswd-c/usr/local/httpd/conf/. awspwd xuhaonew password:re-typeNewpassword:adding Password foruser Xuhao[[email protected]/]# cat/usr/local/httpd/conf/. Awspwd xuhao:ee3ehfdzn4a5c Modify the httpd.conf configuration file to add user authorization [[email protected]/]# vim/usr/local/httpd/conf/httpd.conf<directory"/usr/local/awstats/wwwroot">Options None allowoverride none Order allow,deny allow fromAll AuthName"AWStats Directory"                //define a protected realm nameAuthType Basic//set the type of authenticationAuthuserfile/usr/local/httpd/conf/.awspwd//set the path for saving user accounts and password filesRequire Valid-user//legitimate users to access</Directory>[[Email protected]/]#/etc/init.d/httpd Restart Login Client Access Test

Astats Log Analysis System

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.