makaleler / Debian / Ubuntu / Pardus / awstats kurulumu, birden fazla log dosyasını merge etme, nginx apache merge

awstats kurulumu, birden fazla log dosyasını merge etme, nginx apache merge

15.01.2012 14:15:16

Selamun Aleykum,

Bu notlarımda awstats kurulumu işleyeceğim ve birden fazla log dosyasını merge edeceğiz.

Kurulum için gerekli paketler ve kurulum işlemi
	aptitude install awstats	
	aptitude install libgeo-ip-perl libgeoip1 geoip-database


Awstats yönlendirmesi için html
vim /home/www/awstats/index.html
	<?xml version="1.0" encoding="UTF-8"?>
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[url]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd[/url]">
	<html xmlns="[url]http://www.w3.org/1999/xhtml[/url]">
	<head>
	<meta HTTP-EQUIV="REFRESH" content="0; url=/cgi-bin/awstats.pl">
	</head>
	<body>
	<a href="/cgi-bin/awstats.pl">awstats</a>
	</html>


Apache2 Konfigürasyon Ayarlari
vim /etc/apache2/sites-available/default
         # awstats
         Alias /awstats "/var/www/awstats"
         ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
         <Directory "/usr/lib/cgi-bin">
                 AllowOverride None
                 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                 Order allow,deny
                 Allow from all
         </Directory>
 
         # awstats icin parola gerekiyor
         <FilesMatch "awstats.pl">
                 AuthName "Guvenli Giris"
                 AuthType Basic
                 AuthUserFile /var/www/htpassizleme
                 require valid-user
         </FilesMatch>
 
         # awstats icon
         Alias /awstats-icon/ /usr/share/awstats/icon/
         <Directory /usr/share/awstats/icon>
             Options None
             AllowOverride None
             Order allow,deny
             Allow from all 
         </Directory>


Nginix Kongigürasyon Ayarlari resim ve iconları cachlememesi için
vim /etc/nginx/sites-enabled/default
         # /awstats-icon/
         location ~ ^/awstats-icon/(.*)$ {
                 alias /usr/share/awstats/icon/$1;
                 access_log off;
                 expires 30d;
         }


Çalıştırmak için
/usr/bin/perl /usr/lib/cgi-bin/awstats.pl -update -config=www.mysite.com 


MergeLog kullanarak merge etmek isterseniz gerçi buna gerek yok AWSTATS ın içinde merge edecek betik var.
Merge işlemi için SSH yapılandırmak istemiyorsanız
/usr/bin/mergelog /var/log/apache2/access.log /var/log/nginx/access.log > /var/log/apache_nginx_merge.log


Birden fazla merge edilecek log dosyanız varsa...

Merge ssh ayarlari sh doyası oluşturalım
vim /home/www/awstats/awstats_merge.sh
 #!/bin/bash
 MERGE="/usr/share/awstats/tools/logresolvemerge.pl"
 DIR="/home/www/awstats"
 LOG_APACHE="/var/log/apache2/access.log"
 LOG_NGINX="/var/log/nginx/access.log"

 cp $LOG_APACHE $DIR/access_apache.log
 cp $LOG_NGINX $DIR/access_nginx.log
 $MERGE $DIR/access_apache.log $DIR/access_nginx.log >$DIR/access_merged.log.tmp
 mv $DIR/access_merged.log.tmp $DIR/access_merged.log


Cron dosyamız süreleri kendinize göre ayarlayabilirsiniz.
crontab -e
      25 *    * * * sh /home/www/awstats/awstats_merge.sh >/dev/null 2>&1
      30 *    * * * /usr/bin/perl /usr/lib/cgi-bin/awstats.pl -update -config=www.mysite.com


awstats konfigürasyon dosyamızda yapılması gerekenler
 vim /etc/awstats/awstats.conf
                LogFile="/home/www/awstats/access_merged.log"
                SiteDomain="mysite.com"
		LogFormat=1
		HostAliases="www.mysite.com localhost 127.0.0.1"
		DNSLookup=0
		LoadPlugin="geoip GEOIP_STANDARD /usr/share/GeoIP/GeoIP.dat"
		Lang="en"
yazar husonet

Yorumlar

Bu içerik için sizde yorum yapabilirsiniz!
anasayfa | makaleler | haberler | dosyalar | linkler | hakkımızda