N
nsteth
Guest
Hi. We are using plesk for webhosting, and I want to install another logfile analyzer to get advanced statistics.
Is there a problem with AWStats an Plesk 8 ?
Thanks.
Is there a problem with AWStats an Plesk 8 ?
Thanks.
#!/bin/bash
if [ $# == 0 ]; then
echo "USAGE: $0 <domain name> <ssl support>"
exit
fi
domain=$1
ssl_support=$2
if [ -z "$ssl_support" ]; then
ssl_support=0
fi
# make awstats directory
mkdir -p /var/www/vhosts/$domain/statistics/awstats/
chown apache:apache /var/www/vhosts/$domain/statistics/awstats/
# remove previously added awstats to avoid dupe
if [ -e /var/www/vhosts/$domain/conf/vhost.conf ]; then
cat /var/www/vhosts/$domain/conf/vhost.conf |grep -v "Include /var/www/vhosts/$domain/conf/awstats.conf" > /var/www/vhosts/$domain/conf/vhost.conf.tmp
mv /var/www/vhosts/$domain/conf/vhost.conf.tmp /var/www/vhosts/$domain/conf/vhost.conf
fi
# remove previously added awstats to avoid dupe
if [ -e /var/www/vhosts/$domain/conf/vhost_ssl.conf ]; then
cat /var/www/vhosts/$domain/conf/vhost_ssl.conf |grep -v "Include /var/www/vhosts/$domain/conf/awstats.conf" > /var/www/vhosts/$domain/conf/vhost_ssl.conf.tmp
mv /var/www/vhosts/$domain/conf/vhost_ssl.conf.tmp /var/www/vhosts/$domain/conf/vhost_ssl.conf
fi
# add awstats to SSL domain if SSL was specified
if [ "$ssl_support" -eq 1 ] ; then
cat >> /var/www/vhosts/$domain/conf/vhost_ssl.conf <<EOF
Include /var/www/vhosts/$domain/conf/awstats.conf
EOF
fi
# add awstats to non-SSL domain if SSL is disabled
if [ ! "$ssl_support" -eq 1 ]; then
cat >> /var/www/vhosts/$domain/conf/vhost.conf <<EOF
Include /var/www/vhosts/$domain/conf/awstats.conf
EOF
fi
# generate apache awstats config
cat > /var/www/vhosts/$domain/conf/awstats.conf <<EOF
Alias /awstats/css /usr/share/awstats/wwwroot/css/
Alias /awstats/icon /usr/share/awstats/wwwroot/icon/
Alias /awstats/cgi-bin /usr/share/awstats/wwwroot/cgi-bin/
Alias /awstats/classes /usr/share/awstats/wwwroot/classes/
<Directory /usr/share/awstats/wwwroot/cgi-bin/>
<IfModule mod_perl.c>
<Files ~ (\.pl$)>
SetHandler perl-script
PerlHandler ModPerl::Registry
Options ExecCGI
PerlHandler ModPerl::Registry
Options ExecCGI
allow from all
PerlSendHeader On
</Files>
</IfModule>
</Directory>
<Directory /usr/share/awstats/wwwroot/cgi-bin/>
AuthType Basic
AuthName "Domain statistics"
AuthUserFile /var/www/vhosts/$domain/pd/d..httpdocs@plesk-stat
require valid-user
</Directory>
EOF
# generate awstats mail config
cat > /etc/awstats/awstats.mail.$domain.conf <<EOF
Include "/etc/awstats/awstats.model.conf"
DNSLookup=0
DirData="/var/www/vhosts/$domain/statistics/awstats/"
SiteDomain="mail.$domain"
LogFile="/usr/local/awstats/tools/maillogconvert.pl vadmin $domain < /usr/local/psa/var/log/maillog.processed |"
LogType=M
LogFormat="%time2 %email %email_r %host %host_r %method %url %code %bytesd"
LevelForBrowsersDetection=0
LevelForOSDetection=0
LevelForRefererAnalyze=0
LevelForRobotsDetection=0
LevelForWormsDetection=0
LevelForSearchEnginesDetection=0
LevelForFileTypesDetection=0
ShowMenu=1
ShowSummary=HB
ShowMonthStats=HB
ShowDaysOfMonthStats=HB
ShowDaysOfWeekStats=HB
ShowHoursStats=HB
ShowDomainsStats=0
ShowHostsStats=HBL
ShowAuthenticatedUsers=0
ShowRobotsStats=0
ShowEMailSenders=HBML
ShowEMailReceivers=HBML
ShowSessionsStats=0
ShowPagesStats=0
ShowFileTypesStats=0
ShowFileSizesStats=0
ShowBrowsersStats=0
ShowOSStats=0
ShowOriginStats=0
ShowKeyphrasesStats=0
ShowKeywordsStats=0
ShowMiscStats=0
ShowHTTPErrorsStats=0
ShowSMTPErrorsStats=1
EOF
# generate awstats http config
cat > /etc/awstats/awstats.http.$domain.conf <<EOF
Include "/etc/awstats/awstats.model.conf"
DirData="/var/www/vhosts/$domain/statistics/awstats/"
LogFile="/var/www/vhosts/$domain/statistics/logs/access_log.processed"
LogType=W
LogFormat=1
SiteDomain="www.$domain"
HostAliases="$domain [url]www.[/url]$domain"
EOF
# generate awstats ssl https config
cat > /etc/awstats/awstats.https.$domain.conf <<EOF
Include "/etc/awstats/awstats.model.conf"
DirData="/var/www/vhosts/$domain/statistics/awstats/"
LogFile="/var/www/vhosts/$domain/statistics/logs/access_ssl_log.processed"
LogType=W
LogFormat=1
SiteDomain="www.$domain"
HostAliases="$domain [url]www.[/url]$domain"
UseHTTPSLinkForUrl="/"
EOF
# generate index.html frameset page
cat > /var/www/vhosts/$domain/statistics/index.html <<EOF
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>$domain Statistics</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<frameset rows="30,*" frameborder="NO" border="0" framespacing="0">
<frame src="menu.html" name="topFrame" scrolling="NO" noresize >
<frame src="/awstats/cgi-bin/awstats.pl?config=http.$domain" name="mainFrame">
</frameset>
<noframes><body>
</body></noframes>
</html>
EOF
# generate top menu for frame with links to awstats & webalizer stats
cat > /var/www/vhosts/$domain/statistics/menu.html <<EOF
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
BODY { font-family: Tahoma, Verdana, Arial; font-size: 8pt; }
A { color: #404040; text-decoration: none; font-weight: bold; font-size: 8pt; }
A:hover { text-decoration: none; color: #808080; }
</style>
</head>
<body>
<table width="100%" cellpadding="0" cellspacing="0"><tr><td align="left">
[ <b>awstats</b> ]
<a href="/awstats/cgi-bin/awstats.pl?config=anonftp.$domain" target="mainFrame" title="Anonymous FTP Statistics for $domain">anonymous ftp</a> <small>|</small>
<a href="/awstats/cgi-bin/awstats.pl?config=ftp.$domain" target="mainFrame" title="FTP Statistics for $domain">ftp</a> <small>|</small>
<a href="/awstats/cgi-bin/awstats.pl?config=mail.$domain" target="mainFrame" title="Mail Statistics for $domain">mail</a> <small>|</small>
<a href="/awstats/cgi-bin/awstats.pl?config=https.$domain" target="mainFrame" title="SSL Statistics for $domain">ssl</a> <small>|</small>
<a href="/awstats/cgi-bin/awstats.pl?config=http.$domain" target="mainFrame" title="Web Statistics for $domain">web</a>
</td><td align="right">
[ <b>webalizer</b> ]
<a href="/anon_ftpstat" target="mainFrame" title="Anonymous FTP Statistics for $domain">anonymous ftp</a> <small>|</small>
<a href="/ftpstat" target="mainFrame" title="FTP Statistics for $domain">ftp</a> <small>|</small>
<a href="/webstat-ssl" target="mainFrame" title="SSL Statistics for $domain">ssl</a> <small>|</small>
<a href="/webstat" target="mainFrame" title="Web Statistics for $domain">web</a>
</td></tr></table>
</body>
</html>
EOF
# make sure vhost.conf or vhost_ssl.conf is included by httpd.include
/usr/local/psa/admin/bin/websrvmng --vhost-name=$domain
So tylerc,Here is a wicked script I use for setting up awstats on a site:
USAGE:
./setup_awstats.sh <domain name> <ssl support 0/1>
Most definitely. We looked at Plesk for our FreeBSD dedicateds but when we realized it didn't have AWStats, we reloaded. I was looking at a VPS and Plesk 8, so I stopped by to see if meets the requirements of an average domain user. Looks like I'll have to stop back in a couple years.are they NUTZZZZZZ or what
Can you tell us how to install it GLOBALLY for all 90 domains at once?Originally posted by Lord
there is no probelm with awstats.
i used it and the plugin for webmin for virtual hosts. it works great.
And while he's at it, tell us how to do it on FreeBSD.Can you tell us how to install it GLOBALLY for all 90 domains at once?