awstats cant view previous months

astra

Verified User
Joined
Mar 4, 2009
Messages
94
Hi,

We have problems with awstats, customers cant view the details stats off the previous months it gives only the total visitors and not a option to view it by day of the month, like you can do with www.domain.com/stats/#month


Day Number of visits Pages Hits Bandwidth
01 Mar 2011 73 99 919 4.93 MB
02 Mar 2011 0 0 0 0
03 Mar 2011 0 0 0 0
04 Mar 2011 0 0 0 0
05 Mar 2011 0 0 0 0
06 Mar 2011 0 0 0 0
07 Mar 2011 0 0 0 0
08 Mar 2011 0 0 0 0
09 Mar 2011 0 0 0 0
10 Mar 2011 0 0 0 0
11 Mar 2011 0 0 0 0
12 Mar 2011 0 0 0 0
13 Mar 2011 0 0 0 0
14 Mar 2011 0 0 0 0
15 Mar 2011 0 0 0 0
16 Mar 2011 0 0 0 0
17 Mar 2011 0 0 0 0
18 Mar 2011 0 0 0 0
19 Mar 2011 0 0 0 0
20 Mar 2011 0 0 0 0
21 Mar 2011 0 0 0 0
22 Mar 2011 0 0 0 0
23 Mar 2011 0 0 0 0
24 Mar 2011 0 0 0 0
25 Mar 2011 0 0 0 0
26 Mar 2011 0 0 0 0
27 Mar 2011 0 0 0 0
28 Mar 2011 0 0 0 0
29 Mar 2011 0 0 0 0
30 Mar 2011 0 0 0 0
31 Mar 2011 0 0 0 0
Average 73.00 99.00 919.00 4.93 MB
Total 73 99 919 4.93 MB

Is there a solution to fix this?

Thanks a lot.
 
Hello,

I see only current month in your post. Did I miss anything?

Anyway, months for viewing can be changed in directadmin /see account stats page/.
 
jup thats the problem i can only view the current month in detail stats like above.

If i wanna see the same from the previous month is not possible i can only see the total stats from the month and not in detail like above ( stats/#daysofmonth )
 
Last edited:
Why do you think that's not possible?

User Level Login in Directadmin -> User Stats -> Find Domain AWstats and select a needed Month
 
Thats the problem, it does not work.

If i click Jan 2011 is display march and month february very strange :P:

Days of month

Day Number of visits Pages Hits Bandwidth
01 Feb 2011 79 132 1280 6.94 MB
02 Feb 2011 0 0 0 0
03 Feb 2011 0 0 0 0
04 Feb 2011 0 0 0 0
05 Feb 2011 0 0 0 0
06 Feb 2011 0 0 0 0
07 Feb 2011 0 0 0 0
08 Feb 2011 0 0 0 0
09 Feb 2011 0 0 0 0
10 Feb 2011 0 0 0 0
11 Feb 2011 0 0 0 0
12 Feb 2011 0 0 0 0
13 Feb 2011 0 0 0 0
14 Feb 2011 0 0 0 0
15 Feb 2011 0 0 0 0
16 Feb 2011 0 0 0 0
17 Feb 2011 0 0 0 0
18 Feb 2011 0 0 0 0
19 Feb 2011 0 0 0 0
20 Feb 2011 0 0 0 0
21 Feb 2011 0 0 0 0
22 Feb 2011 0 0 0 0
23 Feb 2011 0 0 0 0
24 Feb 2011 0 0 0 0
25 Feb 2011 0 0 0 0
26 Feb 2011 0 0 0 0
27 Feb 2011 0 0 0 0
28 Feb 2011 0 0 0 0
Average 79.00 132.00 1280.00 6.94 MB
Total 79 132 1280 6.94 MB

We are running always the default installation on our webservers http://directadmin.com/features.php?id=894 and get on every server the same problem.
 
Nop i dont display any days of the previous month i selected.

It is only possible to see now the days of this month and not look back to the days from february etc.

It seems a misconfiguration into awstats ?
 
Last edited:
Oke here a step for step explanation:

If i go to www.domainname.com/stats i can view the stats by day of this month like:

Day Number of visits Pages Hits Bandwidth
01 Mar 2011 73 99 919 4.93 MB
02 Mar 2011 0 0 0 0
03 Mar 2011 0 0 0 0
04 Mar 2011 0 0 0 0
05 Mar 2011 0 0 0 0
06 Mar 2011 0 0 0 0
07 Mar 2011 0 0 0 0
08 Mar 2011 0 0 0 0
09 Mar 2011 0 0 0 0
10 Mar 2011 0 0 0 0
11 Mar 2011 0 0 0 0
12 Mar 2011 0 0 0 0
13 Mar 2011 0 0 0 0
14 Mar 2011 0 0 0 0
15 Mar 2011 0 0 0 0
16 Mar 2011 0 0 0 0
17 Mar 2011 0 0 0 0
18 Mar 2011 0 0 0 0
19 Mar 2011 0 0 0 0
20 Mar 2011 0 0 0 0
21 Mar 2011 0 0 0 0
22 Mar 2011 0 0 0 0
23 Mar 2011 0 0 0 0
24 Mar 2011 0 0 0 0
25 Mar 2011 0 0 0 0
26 Mar 2011 0 0 0 0
27 Mar 2011 0 0 0 0
28 Mar 2011 0 0 0 0
29 Mar 2011 0 0 0 0
30 Mar 2011 0 0 0 0
31 Mar 2011 0 0 0 0
Average 73.00 99.00 919.00 4.93 MB
Total 73 99 919 4.93 MB

But if i wanna do this same option ( User Level Login in Directadmin -> User Stats -> Find Domain AWstats and select a needed Month ) for the month february it dont display any out put of days of the month like this:

Day Number of visits Pages Hits Bandwidth
01 Feb 2011 79 132 1280 6.94 MB
02 Feb 2011 0 0 0 0
03 Feb 2011 0 0 0 0
04 Feb 2011 0 0 0 0
05 Feb 2011 0 0 0 0
06 Feb 2011 0 0 0 0
07 Feb 2011 0 0 0 0
08 Feb 2011 0 0 0 0
09 Feb 2011 0 0 0 0
10 Feb 2011 0 0 0 0
11 Feb 2011 0 0 0 0
12 Feb 2011 0 0 0 0
13 Feb 2011 0 0 0 0
14 Feb 2011 0 0 0 0
15 Feb 2011 0 0 0 0
16 Feb 2011 0 0 0 0
17 Feb 2011 0 0 0 0
18 Feb 2011 0 0 0 0
19 Feb 2011 0 0 0 0
20 Feb 2011 0 0 0 0
21 Feb 2011 0 0 0 0
22 Feb 2011 0 0 0 0
23 Feb 2011 0 0 0 0
24 Feb 2011 0 0 0 0
25 Feb 2011 0 0 0 0
26 Feb 2011 0 0 0 0
27 Feb 2011 0 0 0 0
28 Feb 2011 0 0 0 0
Average 79.00 132.00 1280.00 6.94 MB
Total 79 132 1280 6.94 MB

So the point is you dont see any stats by day, only the total use of that month.

I hope you understand the issue for the customer.
 
Oke i have changes the awstats_process.sh like this http://www.directadmin.com/features.php?id=974

awstats_process.sh copy:

Code:
#!/bin/sh
# This script is written by Martynas Bendorius and DirectAdmin
# It is used to process AWstats for a domain
# Official AWstats webpage: http://www.awstats.org
# Usage:
# ./awstats_user.sh <user> <domain>

ADD_CGI=1
ADD_HTML=1

OS=`uname`
ROOTGRP=root
if [ "$OS" = "FreeBSD" ]; then
        ROOTGRP=wheel
fi

if [ "${ADD_CGI}" -eq 0 ] && [ "${ADD_HTML}" -eq 0 ]; then
	echo "One of ADD_CGI and ADD_HTML must be set to 1";
	exit 10;
fi

AUID=`/usr/bin/id -u`
if [ "$AUID" != 0 ]; then
        echo "You require Root Access to run this script";
        exit 1;
fi

if [ $# != 2 ] && [ $# != 3 ]; then
        echo "Usage:";
        echo "$0 <user> <domain> (<subdomain>)";
        echo "you gave #$#: $0 $1 $2";
        exit 2;
fi

id ${1} >/dev/null 2>&1
RET=$?
if [ "${RET}" -ne 0 ]; then
	echo "User ${1} does not exist";
	exit 3;
fi

SUB="";
if [ $# = 3 ]; then
        SUB=$3
fi

USER=$1
DOMAIN=$2
UHOME=`grep -e "^${USER}:" /etc/passwd | cut -d: -f6`

if [ "$UHOME" = "" ]; then
	echo "Could not find a home path for user $USER in /etc/passwd";
	exit 4;
fi

AWSTATS=/usr/local/awstats
MODEL=${AWSTATS}/wwwroot/cgi-bin/awstats.model.conf
STATS_DIR=${UHOME}/domains/${DOMAIN}/awstats
DATA=.data
DATA_DIR=${STATS_DIR}/${DATA}
LOGDIR=/var/log/httpd/domains

if [ "${SUB}" != "" ]; then
	STATS_DIR=$STATS_DIR/${SUB}
	DATA_DIR=${STATS_DIR}/${DATA}
	CONFIG=${DATA_DIR}/awstats.${SUB}.${DOMAIN}.conf
	LOG=${LOGDIR}/${DOMAIN}.${SUB}.log

	#we change the domain name at the last possible moment, after we're done with DOMAIN.
	#all calls to DOMAIN from this point onwards will see sub.domain.com
	DOMAIN=${SUB}.${DOMAIN}
else
	CONFIG=${DATA_DIR}/awstats.${DOMAIN}.conf
	LOG=${LOGDIR}/${DOMAIN}.log
fi

if [ ! -e ${AWSTATS} ]; then
	echo "${AWSTATS} does not exist!";
	exit 5;
fi

if [ ! -e ${STATS_DIR} ]; then
	mkdir ${STATS_DIR};
	chmod 755 ${STATS_DIR}
else
	if [ -h ${STATS_DIR} ]; then
		echo "${STATS_DIR} is a symbolic link. Aborting.";
		exit 8;
	fi
fi

if [ ! -e ${DATA_DIR} ]; then
	mkdir ${DATA_DIR}
	chmod 755 ${DATA_DIR}
else
	if [ -h ${DATA_DIR} ]; then
		echo "${DATA_DIR} is a symbolic link. Aborting.";
		exit 9;
	fi
fi

#this bit is to fix the 700 that backups cannot see. (bug)
#http://www.directadmin.com/features.php?id=915
chmod 755 ${DATA_DIR}

#do it every time.  Users must not be able to edit the config directly.
chown -R root:${ROOTGRP} ${DATA_DIR}

if [ ! -e ${CONFIG} ]; then
	if [ ! -e ${MODEL} ]; then
		echo "${MODEL} does not exist.";
		exit 6;
	fi

        cp -f ${MODEL} ${CONFIG}
        chmod 644 ${CONFIG}
        perl -pi -e "s#LogFile=\"/var/log/httpd/mylog.log\"#LogFile=\"${LOG}\"#" ${CONFIG}
        perl -pi -e "s#SiteDomain=\"\"#SiteDomain=\"${DOMAIN}\"#" ${CONFIG}
	perl -pi -e "s#DirData=\".\"#DirData=\"${DATA_DIR}\"#" ${CONFIG}
        perl -pi -e "s#DirCgi=\"/cgi-bin\"#DirCgi=\/awstats\"#" ${CONFIG}
        #perl -pi -e "s#DirIcons=\"/icon\"#DirIcons=\"${STATS_DIR}\"#" ${CONFIG} #moved below to different value
	perl -pi -e "s#ValidHTTPCodes=\"200 304\"#ValidHTTPCodes=\"200 304 206\"#" ${CONFIG}

	#Oct 24, 2010
	perl -pi -e "s#DirIcons=\"/icon\"#DirIcons=\"icon\"#" ${CONFIG}

	#mkdir -p ${STATS_DIR}  #not required anymore

	#April 17, changed to link, below
        #cp -Rp ${AWSTATS}/wwwroot/icon ${STATS_DIR}

        chown -R root:${ROOTGRP} ${STATS_DIR}
	chown ${USER}:${USER} ${STATS_DIR}
else
	perl -pi -e "s#DirIcons=\"${STATS_DIR}\"#DirIcons=\"icon\"#" ${CONFIG}
fi



ICON=${STATS_DIR}/icon
if [ ! -h $ICON ]; then
	rm -rf $ICON
	ln -sf ${AWSTATS}/wwwroot/icon $ICON
fi


#Oct 24, 2010
if [ "${ADD_CGI}" -eq 1 ]; then
	#copy cgi-bin bits to awstats directory.

	if [ ! -e "${STATS_DIR}/awstats.pl}" ]; then
		cp ${AWSTATS}/wwwroot/cgi-bin/awstats.pl ${STATS_DIR}/awstats.pl

		#make a few changes so it can find the config.
		perl -pi -e "s#\"\$DIR\",\s+\"/etc/awstats\",#\"\$DIR\",\t\"${UHOME}/domains/${DOMAIN}/awstats/.data\",#" ${STATS_DIR}/awstats.pl

		#repeat for variations of the awstats.pl files
		#perl -pi -e "s#\"\$DIR\",\"/etc/awstats\",#\"\$DIR\",\"${UHOME}/domains/${DOMAIN}/awstats/.data\",#" ${STATS_DIR}/awstats.pl
		perl -pi -e "s#\"/etc/awstats\"#\"${UHOME}/domains/${DOMAIN}/awstats/.data\"#" ${STATS_DIR}/awstats.pl

		chown ${USER}:${USER} ${STATS_DIR}/awstats.pl
	fi

	if [ ! -e "${STATS_DIR}/lang" ]; then
		ln -s ${AWSTATS}/wwwroot/cgi-bin/lang ${STATS_DIR}/lang
	fi

	if [ ! -e "${STATS_DIR}/lib" ]; then
		ln -s ${AWSTATS}/wwwroot/cgi-bin/lib ${STATS_DIR}/lib
	fi

	if [ ! -e "${STATS_DIR}/plugins" ]; then
		ln -s ${AWSTATS}/wwwroot/cgi-bin/plugins ${STATS_DIR}/plugins
	fi

	#WWWCONFIG=${DATA_DIR}/awstats.www.${DOMAIN}.conf
	#if [ ! -e ${WWWCONFIG} ]; then
	#	ln -s awstats.${DOMAIN}.conf ${WWWCONFIG}
	#fi

	HTACCESS=${STATS_DIR}/.htaccess
	ADD_HTA=0
	if [ ! -e ${HTACCESS} ]; then
		ADD_HTA=1
	else
		#check it's contents
		COUNT=`grep -c 'DirectoryIndex awstats.pl' ${HTACCESS}`
		if [ "${COUNT}" -eq 0 ]; then
			ADD_HTA=1
		fi
	fi

	if [ -h ${HTACCESS} ]; then
		echo "${HTACCESS} is a symbolic link. Aborting.";
		exit 11;
	fi

	if [ "${ADD_HTA}" -eq 1 ]; then
		echo "Options -Indexes +ExecCGI" >> ${HTACCESS}
		echo "AddHandler cgi-script .pl" >> ${HTACCESS}
		echo "DirectoryIndex awstats.pl" >> ${HTACCESS}
		echo "" >> ${HTACCESS}
		echo "RewriteEngine On" >> ${HTACCESS}
		echo "RewriteCond %{HTTP_HOST} ^www.${DOMAIN}\$ [NC]" >> ${HTACCESS}
		echo "RewriteRule ^(.*)\$ http://${DOMAIN}/awstats/\$1 [R=301,L]" >> ${HTACCESS}
	fi
fi


if [ "${ADD_HTML}" -eq 1 ]; then

	BD='-builddate=%YY%MM'
	#02-03-11 remcop fix dagen van de vorige maand awstats
	if [ "$DAY" -eq 1 ]; then
        YYMM=`date --date='yesterday' +%y%m`
        BD="-builddate=$YYMM"
	fi
	
	#this doesn't work because there are 4 hours of the next month in the logs on the first day.
	#They empty the stats from the old html for last month.
	#DAY=`date +%e`
	#if [ "$DAY" -eq 1 ]; then
	#	YYMM=`date --date='yesterday' +%y%m`
	#	BD="-builddate=$YYMM"
	#fi

	#-lang=en
	/usr/bin/perl ${AWSTATS}/tools/awstats_buildstaticpages.pl -config=${DOMAIN} -configdir=${DATA_DIR} -update -diricons=icon -awstatsprog=${AWSTATS}/cgi-bin/awstats.pl -dir=${STATS_DIR} $BD
	RET=$?
	#02-03-11 remcop fix dagen van de vorige maand awstats
	
	if [ "$DAY" -eq 1 ]; then
        MAIN_FILE=awstats.${DOMAIN}.`date --date='yesterday' +%y%m`.html
else
	#we stil need to set a value though:
		MAIN_FILE=awstats.${DOMAIN}.`date +%y%m`.html
	fi

	MAIN_HTML=${STATS_DIR}/${MAIN_FILE}
	INDEX_HTML=${STATS_DIR}/index.html

	#changes per month
	ln -sf ${MAIN_FILE} ${INDEX_HTML}

else
	#this is for the case where we dont want to waste time with static html files (ADD_HTML=0) but ADD_CGI is still on.
	#due to the check check for !ADD_HTML&&!ADD_CGI above, ADD_CGI must be 1 at this point.
	
	/usr/bin/perl ${AWSTATS}/tools/awstats_updateall.pl now -configdir=${DATA_DIR} -awstatsprog=${AWSTATS}/cgi-bin/awstats.pl
	# -excludeconf=awstats.www.${DOMAIN}.conf we're using mod_rewrite to change www.domain.com/awstast to domain.com/awstats, since only domain.com/awstats works unless we link every single data file (ugly).
	RET=$?
fi

exit $RET;

But if i run manually:

Code:
/usr/local/directadmin/scripts/awstats_process.sh username domainname.com

i get a error: usr/local/directadmin/scripts/awstats_process.sh: line 232: [: : integer expression expected

did some know whats wrong?
 
Back
Top