• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

webalizer and subdomains

K

kklemenss

Guest
Is there any possibility to have subdomain statistics with webalizer? On windows plesk i have AWstat and i like it, but for linux version of plesk there is no AWstat...

can somebody help me pliz

thanks
 
Yes, it is possible to set this up, but it needs some work.

- You need to create separate log files for the subdomain by placing the following inside the subdomains vhost.conf:

CustomLog /var/www/vhosts/<domain>/statistics/logs/<subdomain>_access_log plesklog
ErrorLog /var/www/vhosts/<domain>/statistics/logs/<subdomain>_error_log

- Next create a directory for the statistics:

mkdir /var/www/vhosts/<domain>/subdomains/<subdomain>/webstat

- Add an alias to your subdomains vhost.conf file so you can call the statistics even though they are not in yout httpdocs directory:

Alias /webstat /var/www/vhosts/<domain>/subdomains/<subdomain>/webstat

The only thing missing now is logrotation for the new logs (maybe thats done by standard logrotation of that domain - you should check this) and the webalizer call which can be placed in a shell script in cron.daily:

#!/bin/sh
webalizer -p -q -c /var/www/vhosts/<domain>/conf/webalizer.conf -o /var/www/vhosts/<domain>/subdomains/<subdomain>/webstat
 
must i do someting else.. that this will start to work? now on my domain i get Access forbidden!

how can i check if this is working?
 
I guess you get Access forbidden when trying to access webstat directory, right?

Right now there are no logs there and the logs were never processed with webalizer - therefore the directory is empty.

- When you access the subdomain - is it logged in the new log files?

- When you run the command

webalizer -p -q -c /var/www/vhosts/<domain>/conf/webalizer.conf -o /var/www/vhosts/<domain>/subdomains/<subdomain>/webstat /var/www/vhosts/<domain>/statistics/logs/<subdomain>_access_log

does it create the files in the subdomain webstat directory?

BTW: Please correct the script line in the file for cron.daily with the above one - I missed the logfile in my first answer
 
coko u are god! now its working, but i msut add this in cron. really tnx!
 
Originally posted by kklemenss
coko u are god! now its working, but i msut add this in cron. really tnx!

I guess you mean good, not god :D

Dealing with this kind of stuff is my daily work - and I still like it :)
 
one question more... in /etc/cron.daily/webalizer i have this script:

#!/bin/sh
# /etc/cron.daily/webalizer: webalizer daily maintenance script
# Written by Remco van de Meent <[email protected]>

WEBALIZER_BIN=/usr/bin/webalizer
WEBALIZER_CONF=/etc/webalizer.conf

# See if the webalizer binary and config file exists
# if not, exit without warning to prevent daily mails
[ -f ${WEBALIZER_BIN} ] || exit 0
[ -f ${WEBALIZER_CONF} ] || exit 0

# Figure out non-rotated logfile
nonrotatedlog=`egrep '^LogFile' $WEBALIZER_CONF | \
sed -e 's/[[:space:]]\+/ /' | \
cut -d ' ' -f2 | \
sed -e 's/\.[[:digit:]][\.gz]*$//'`

# Can we read it?
[ -r "${nonrotatedlog}" ] || exit 0

# Check for empty logfile
logsz=`echo ${nonrotatedlog} | \
sed -e 's/[[:space:]]\+/ /' | \
cut -d ' ' -f2 | \
xargs ls -l | \
sed -e 's/[[:space:]]\+/ /g' | \
cut -d ' ' -f5`
[ $logsz -gt 0 ] || exit 0

# Run webalizer quietly
${WEBALIZER_BIN} -c ${WEBALIZER_CONF} -q
${WEBALIZER_BIN} -c ${WEBALIZER_CONF} -q ${nonrotatedlog}

# Exit with webalizer's exit code
exit $?

do i add thoes lines in here or? webalizer -p -q -c /var/www/vhosts... line
 
Back
Top