Log analysis tool awstats Multi-site log analysis

Source: Internet
Author: User
Tags define chmod config continue documentation naming convention

The first two are all about how to deploy the Awstats log Analysis tool under Nginx, and now it's finally Apache. As a veteran Web server, Awstats's support for Apache is perfect, so the entire configuration process is very simple. So, here I expanded the deployment to achieve a multi-site logging analysis.

Note: Since this blog post was published, apache-2.4.x could not support the deployment of Awstats log analysis results access to dynamic, but you can use the previous Log Analysis tool Awstats combat nginx Chapter-Analysis Results static method described in the implementation of deployment Awstats. Therefore, this blog post will use the apache2.2.25 version to explain how to deploy Awstats log analysis results dynamic and multi-site.

Environment:

CentOS 6.4 x86_64
ip:192.168.1.113
Site 1: Domain www.sunsky.com (server and client are parsed through Hosts file)
Site 2: Domain www.skysun.com (server and client are parsed through Hosts file)
apache-2.2.25 compile installation, path/usr/local/apache, service open state
The logging format is the Apache default combined format and must not be changed, or it can cause Awstats to parse the log.
Logformat "%h%l%u%t \%r\"%>s%b \ "%{referer}i\" \ "%{user-agent}i\" "combined
apr-1.4.8 apr-util-1.5.2
Awstats-7.2.tar.gz

One, automatic log cutting

Because Apache with the log polling tool Rotatelogs, according to experts said in the log cutting easy to lose the log, so here we use Cronolog to do log cutting.

1. Download and install Cronolog

cd/server/tools/
wget http://cronolog.org/download/cronolog-1.6.2.tar.gz
Tar zxf cronolog-1.6.2.tar.gz
CD cronolog-1.6.2
./configure
Make&&make Install

2, configure Apache use Cronolog

Because the experimental Apache enabled the virtual host function, the following configuration is carried out in the virtual host, so as to facilitate the analysis of multi-site operations.

Vim/usr/local/apache/httpd/extra/httpd-vhosts.conf

Replace the Customlog and errorlog in the configuration file with the following (since we're going to multiple sites, we're going to replace two virtual hosts here and make a valid distinction between the log names).

Www.sunsky.com
Customlog "|/usr/local/sbin/cronolog/app/logs/sunsky_access_%y%m%d.log" combined
ErrorLog "|/usr/local/sbin/cronolog/app/logs/sunsky_error_%y%m%d.log"
Www.skysun.com
Customlog "|/usr/local/sbin/cronolog/app/logs/skysun_access_%y%m%d.log" combined
ErrorLog "|/usr/local/sbin/cronolog/app/logs/skysun_error_%y%m%d.log"

Note: Here you must pay attention to the two Web site log name configuration.

Ii. installation and configuration of Awstats

1. Deploy Awstats

First we download the Awstats package and place it under the regular directory (/usr/local)

wget http://awstats.sourceforge.net/files/awstats-7.2.tar.gz
Tar zxf awstats-7.2.tar.gz
MV Awstats-7.2/usr/local/awstats

Because the permissions in the package downloaded by wget are not root, you have to modify the permissions here, otherwise *.pl will not be able to run later

Chown-r Root.root/usr/local/awstats
chmod +x/usr/local/awstats/tools/*.pl
chmod +x/usr/local/awstats/wwwroot/cgi-bin/*.pl

Next we are going to execute the awstats_configure.pl Configuration Wizard under Awstats/tools to generate Awstats configuration files, awstats the naming convention for the profile is awstats.website.conf

cd/usr/local/awstats/tools/
./awstats_configure.pl

The following prompts appear

-----AWStats Awstats_configure 1.0 (Build 1.9) (c) Laurent destailleur-----This tool'll help you to configure Awstat s to analyze statistics for one Web server.
Can try to use it to let it does all this is possible in AWStats Setup, however following the "step" by step Manual setup Documentation (docs/index.html) is often a better idea. Above All if:-Your are isn't an administrator user,-your want to analyze downloaded log files without Web server,-your WA  NT to analyze mail or FTP log files instead of Web log files,-your need to analyze load balanced servers log files,-
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 install Enter full config file path of yo
ur Web server. Example:/etc/httpd/httpd.conf Example:/usr/local/apache2/conf/httpd.conf example:c:\program files\apache Group\ apache\conf\httpd.conf Config file path (' None ' to SKIP Web Server Setup: >/usr/local/apache/conf/httpd.conf #有可能是新版本的原因, this will automatically find Apache configuration file, do not need to fill out our own, but will ask you once, you answer Y can
Your Web server config file (s) could not is found. You'll need to the setup your Web server manually to declare AWStats script as a CGI, if your want to build reports dynamical
Ly. AWStats Setup documentation (file docs/index.html)-----> 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 and want me to build a new AWStats Config/profile file (required if I install) [y/n]? Y #询问是否创建一个新的配置文件, fill in y-----> Define config file name to create What are the name of your Web site or profile
Alysis? Example:www.mysite.com Example:demo Your Web site, virtual server or profile name: > www.sunsky.com #这里让填写你的网站域名
, the virtual host name or any configuration name-----> Define config file path in which directory does you want to store your config file (s)? Default:/etc/awstats
Directory path to store config file (s) (Enter for default): > #这里要填写你配置文件存放路径, we use it by default path/etc/awstats, so direct Enter-----> Create config file '/etc/awstats/awstats.www.sunsky.com.conf ' config file/etc/awstats/
Awstats.www.sunsky.com.conf created.
-----> Add update process inside a scheduler Sorry, configure.pl does not support automatic add to cron yet.  Can do it manually by adding the following command to your cron:/usr/local/awstats/wwwroot/cgi-bin/awstats.pl-update -config=www.sunsky.com Or If you have several config files and prefer have only one command:/usr/local/awstats/tools/a  wstats_updateall.pl now press ENTER to continue ... #提示不能自动加入crontab定时任务, you need to add it later, we press ENTER to continue A simple config file has been Created:/etc/awstats/awstats.www.sunsky.com.conf you should have a look inside to check and change manually main Paramet
ERs. can then manually update your statistics for ' www.sunsky.com ' with command: > Perl awstats.pl-update-config=www.s Unsky.com YOU can also build static on pages for ' www.sunsky.com ' with command: > Perl awstats.pl-output=pagetype-config=www Sunsky.com press ENTER to finish ... #提示配置文件创建完成和如何更新配置及建立静态报告页, here we can end this configuration wizard

After completing this wizard, we have already configured the Awstats configuration file of the Www.sunsky.com site, the following configuration www.skysun.com configuration file, step and above, just make changes in the domain name place.

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.