1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

webalizer and subdomains

Discussion in 'Plesk for Linux - 8.x and Older' started by kklemenss, Oct 25, 2005.

  1. kklemenss

    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

  2. CoKo

    CoKo Guest

    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:

    webalizer -p -q -c /var/www/vhosts/<domain>/conf/webalizer.conf -o /var/www/vhosts/<domain>/subdomains/<subdomain>/webstat
  3. kklemenss

    kklemenss Guest

    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?
  4. CoKo

    CoKo Guest

    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
  5. kklemenss

    kklemenss Guest

    coko u are god! now its working, but i msut add this in cron. really tnx!
  6. CoKo

    CoKo Guest

    I guess you mean good, not god :D

    Dealing with this kind of stuff is my daily work - and I still like it :)
  7. kklemenss

    kklemenss Guest

    GOD and GOOD! ;)
  8. kklemenss

    kklemenss Guest

    one question more... in /etc/cron.daily/webalizer i have this script:

    # /etc/cron.daily/webalizer: webalizer daily maintenance script
    # Written by Remco van de Meent <remco@debian.org>


    # 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 ${nonrotatedlog}

    # Exit with webalizer's exit code
    exit $?

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