AWStats

De Babel Digital
Revisão de 09h38min de 6 de dezembro de 2010 por Avena (discussão | contribs)

(dif) ← Edição anterior | Revisão atual (dif) | Versão posterior → (dif)

Instalação:

cd /opt
wget http://awstats.sourceforge.net/files/awstats-7.0.tar.gz
tar xf awstats-7.0.tar.gz
mv awstats-7.0 awstats
cd awstats/tools/
perl awstats_configure.pl

# perl awstats_configure.pl

----- AWStats awstats_configure 1.0 (build 1.9) (c) Laurent Destailleur ----- This tool will help you to configure AWStats to analyze statistics for one web server. You can try to use it to let it do all that 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: - You are not an administrator user, - You want to analyze downloaded log files without web server, - You want to analyze mail or ftp log files instead of 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 Warning: AWStats standard directory on Linux OS is '/usr/local/awstats'. If you want to use standard directory, you should first move all content of AWStats distribution from current directory: /opt/awstats to standard directory: /usr/local/awstats And then, run configure.pl from this location. Do you want to continue setup from this NON standard directory [yN] ? Y
-----> Check for web server install
Enter full config file path of your 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): > none
Your web server config file(s) could not be found. You will need to setup your web server manually to declare AWStats script as a CGI, if you want to build reports dynamically. See AWStats setup documentation (file docs/index.html)
-----> Update model config file '/opt/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/profile file (required if first install) [y/N] ? Y
-----> Define config file name to create What is the name of your web site or profile analysis ? Example: www.mysite.com Example: demo Your web site, virtual server or profile name: > mocambos.net
-----> Define config file path In which directory do you plan to store your config file(s) ? Default: /etc/awstats Directory path to store config file(s) (Enter for default): >
-----> Create config file '/etc/awstats/awstats.mocambos.net.conf' Config file /etc/awstats/awstats.mocambos.net.conf created.
-----> Add update process inside a scheduler Sorry, configure.pl does not support automatic add to cron yet. You can do it manually by adding the following command to your cron: /opt/awstats/wwwroot/cgi-bin/awstats.pl -update -config=mocambos.net Or if you have several config files and prefer having only one command: /opt/awstats/tools/awstats_updateall.pl now

A SIMPLE config file has been created: /etc/awstats/awstats.mocambos.net.conf You should have a look inside to check and change manually main parameters. You can then manually update your statistics for 'mocambos.net' with command: > perl awstats.pl -update -config=mocambos.net You can also build static report pages for 'mocambos.net' with command: > perl awstats.pl -output=pagetype -config=mocambos.net

Vamos criar diretório data e dar permissão a outros usuários:

mkdir data
chmod 755 data

Veja onde seus logs seja do nginx ou apache. Separe na conf de cada site um log pra cada site e acesso,

ls /var/log/nginx/
access.log		     localhost.access.log	      redrecicladores.access.log
democraciaweb.access.log     mcdcorretora.access.log	      rls.access.log
error.log		     mncr.access.log		      solidariedadeacuba.access.log
fabricadetv.access.log	     mocambos.access.log	      teiaculturaviva.access.log
girassolacg.access.log	     mocambos.access.log.2	      tvlan.access.log
hospedagemplone.access.log   mulhereslivres.access.log	      vazquezppg.access.log
jocbrasil.access.log	     munin.ps16377.dreamhost.com.log
linguagemdigital.access.log  noisnarua.access.log

Vamos usar log da mocambos.net
Criar arquivo com base no /opt/awstats/wwwroot/cgi-bin/awstats.model.conf

nano /etc/awstats/awstats.www.mocambos.net.conf

Pra criar outras conf

cp /opt/awstats/wwwroot/cgi-bin/awstats.model.conf /etc/awstats/awstats.www.dominio.tdl.conf 

Criar diretorio pra paginas html

mkdir -p /opt/awstats/data/dominio.tdl/visitas/

Editar linha 153

SiteDomain="www.dominio.tdl"

Editar linha 203

DirData="/opt/awstats/data/dominio.tdl/visitas/"


Configuração dentro do nginx
www.dominio.tdl/visitas - abaixo do dominio. (tarefa separar cada dominio em .conf propria)

       location ~ ^/visitas {
               root   /opt/awstats/data/domino.tdl;
               index  awstats.www.domino.tdl index.html;
       }
 
location ~ ^/icon/ { root /opt/awstats/wwwroot; index index.html; }


Ai deixar no cron pra de tempo em tempo gerar o html

/opt/awstats/tools/awstats_buildstaticpages.pl -config=www.domino.tdl -update -awstatsprog=/opt/awstats/wwwroot/cgi-bin/awstats.pl -dir=/opt/awstats/data/domino.tdl/visitas > /dev/null