[SOLVED] AWstats and ISPconfig 3.0.5.4p5 don't generate html

Discussion in 'Installation/Configuration' started by Fabrizio, Jan 18, 2015.

  1. Fabrizio

    Fabrizio New Member

    Hi, I cannot run AWstats. Maybe i'm missing something.. Can someone help me? :)

    I've tested it on debian (squeeze and wheezy) without any success.
    My production server have squeeze with latest ISPconfig release. SO is fully updated.
    Symptom are this: in domain.com/stats url after put credentials, I can see "Jump to previous stats" and below a frame
    ERROR 404 - Not Found!
    So my static page is not builded.
    here my /etc/cron.d/awstats
    Code:
    */10 * * * * www-data [ -x /usr/share/awstats/tools/update.sh ] && /usr/share/awstats/tools/update.sh
    
    # Generate static reports:
    10 03 * * * www-data [ -x /usr/share/awstats/tools/buildstatic.sh ] && /usr/share/awstats/tools/buildstatic.sh
    crontab -l
    Code:
    * * * * * /usr/local/ispconfig/server/server.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
    30 00 * * * /usr/local/ispconfig/server/cron_daily.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
    In /etc/awstats i can see my awstats.$DOMAINS.conf with correct LogFile
    In /var/lib/awstats there are some .txt and dnscachelastupdate.has files related to my domains

    Running /usr/share/awstats/tools/update.sh from www-data user produce the follow output:
    Code:
    Error: SiteDomain parameter not defined in your config/domain file. You must edit it for using this version of AWStats.
    Setup ('/etc/awstats/awstats.conf' file, web server or permissions) may be wrong.
    Check config file, permissions and AWStats documentation (in 'docs' directory).
    Running /usr/share/awstats/tools/buildstatic.sh produce no ouput.

    Stats folder have this permission:
    Code:
    drwxr-xr-x  2 root  root 
    Obviously have set from web panel AWstats from Webstatistics program.

    ( BTW Webalizer stats don't work too)

    Can any one help me?

    EDIT

    here what i see in /var/cache/awstats/domain.com/2015/01
    Code:
    /var/cache/awstats/domain.com/2015/01# ls
    awstats.domain.com.alldomains.en.html     awstats.domain.com.osdetail.en.html
    awstats.domain.com.allhosts.en.html       awstats.domain.com.refererpages.en.html
    awstats.domain.com.allrobots.en.html      awstats.domain.com.refererse.en.html
    awstats.domain.com.browserdetail.en.html  awstats.domain.com.session.en.html
    awstats.domain.com.en.html                awstats.domain.com.unknownbrowser.en.html
    awstats.domain.com.errors404.en.html      awstats.domain.com.unknownip.en.html
    awstats.domain.com.keyphrases.en.html     awstats.domain.com.unknownos.en.html
    awstats.domain.com.keywords.en.html       awstats.domain.com.urldetail.en.html
    awstats.domain.com.lasthosts.en.html      awstats.domain.com.urlentry.en.html
    awstats.domain.com.lastrobots.en.html     awstats.domain.com.urlexit.en.html
    So static page are built, but they aren't moved in the right place?
     
    Last edited: Jan 18, 2015
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The reason is that you called the buildstaticpages.sh script manually while ispconfig calls it with the correct parameters. Wait until ispconfig has run the script nightly to the the awstats files in the correct folder.
     
  3. Fabrizio

    Fabrizio New Member

    It looks like you have partially right. On a server with debian Wheezy at 00.30 stats were generated, but on my Squeeze server (production) I have the same error :(
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    please compare the root crontab on both servers (command: crontab -l).
    -- Update -- Sorry. Did not notice that you posted it above already.
    is the awstats build static pages script in the same location on both servers?
     
  5. Fabrizio

    Fabrizio New Member

    NOT WORKING
    Code:
    
    [email protected]:~# locate buildstatic
    /usr/share/awstats/tools/awstats_buildstaticpages.pl
    /usr/share/awstats/tools/buildstatic.sh
    [email protected]:~# uname -a
    Linux ns1.domain.com 2.6.32-5-vserver-amd64 #1 SMP Wed Apr 9 22:06:23 UTC 2014 x86_64 GNU/Linux
    [email protected]:~# cat /etc/debian_version
    6.0.10
    [email protected]:~# locate awstats.pl
    /usr/lib/cgi-bin/awstats.pl
    [email protected]:~# /usr/lib/cgi-bin/awstats.pl
    ----- awstats 6.95 (build 1.943) (c) 2000-2009 Laurent Destailleur -----
    AWStats is a free web server logfile analyzer to show you advanced web
    statistics.
    [email protected]:~# crontab -l
    * * * * * /usr/local/ispconfig/server/server.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
    30 00 * * * /usr/local/ispconfig/server/cron_daily.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
    
    [email protected]:~# cat /var/log/ispconfig/cron.log | grep 00:3
    Mon Jan 19 00:30:05 CET 2015 sh: mailq: command not found
    Mon Jan 19 00:30:06 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client5/web9
    Mon Jan 19 00:30:08 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client7/web21
    Mon Jan 19 00:30:17 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client15/web10
    Mon Jan 19 00:30:24 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client4/web11
    Mon Jan 19 00:30:27 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client6/web12
    Mon Jan 19 00:31:17 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client17/web19
    Mon Jan 19 00:31:30 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client3/web16
    Mon Jan 19 00:31:37 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client12/web17
    Mon Jan 19 00:31:44 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client2/web22
    Mon Jan 19 00:35:04 CET 2015 sh: mailq: command not found
    Tue Jan 20 00:30:05 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client5/web9
    Tue Jan 20 00:30:05 CET 2015 sh: mailq: command not found
    Tue Jan 20 00:30:08 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client7/web21
    Tue Jan 20 00:30:18 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client15/web10
    Tue Jan 20 00:30:25 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client4/web11
    Tue Jan 20 00:30:29 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client6/web12
    Tue Jan 20 00:31:30 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client17/web19
    Tue Jan 20 00:31:45 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client3/web16
    Tue Jan 20 00:31:56 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client12/web17
    Tue Jan 20 00:32:06 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client2/web22
    Tue Jan 20 00:35:05 CET 2015 sh: mailq: command not found
    Tue Jan 20 19:00:38 CET 2015 sh: mailq: command not found
    
    WORKING
    Code:
    [email protected]:~# locate buildstatic
    /usr/share/awstats/tools/awstats_buildstaticpages.pl
    /usr/share/awstats/tools/buildstatic.sh
    [email protected]:~# uname -a
    Linux isp 2.6.32-27-pve #1 SMP Tue Feb 11 16:18:29 CET 2014 x86_64 GNU/Linux
    
    [email protected]:~# cat /etc/debian_version
    7.8
    locate awstats.pl
    /usr/lib/cgi-bin/awstats.pl
    [email protected]:~# /usr/lib/cgi-bin/awstats.pl
    ----- awstats 7.0 (build 1.971) (c) 2000-2010 Laurent Destailleur -----
    AWStats is a free web server logfile analyzer to show you advanced web
    statistics.
    [email protected]:~# crontab -l
    * * * * * /usr/local/ispconfig/server/server.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
    30 00 * * * /usr/local/ispconfig/server/cron_daily.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
    
    On this server there is not previous error on /var/log/ispconfig/cron.log.
    Now i've added a new site on non-working server... i'll post new log tomorrow!
     
  6. Fabrizio

    Fabrizio New Member

    i've found a discrepancy:
    NOT-WORKING
    Code:
    cat awstats.domain.com.conf
    Include "/etc/awstats/awstats.conf"
    LogFile="/var/log/ispconfig/httpd/domain.com/access.log"
    SiteDomain="domain.com"
    HostAliases="www.domain.com  localhost 127.0.0.1"
    Code:
    [email protected]:/etc/awstats# ls /var/log/ispconfig/httpd/domain.com/
    20150120-access.log  20150121-access.log  access.log  error.log

    WORKING

    Code:
    ls /var/log/ispconfig/httpd/prova.net
    20150118-access.log.gz  20150119-access.log.gz  20150120-access.log  20150121-access.log  access.log  error.log  yesterday-access.log
    Code:
    cat awstats.prova.net.conf
    Include "/etc/awstats/awstats.conf"
    LogFile="/var/log/ispconfig/httpd/prova.net/yesterday-access.log"
    SiteDomain="prova.net"
    HostAliases="www.prova.net localhost 127.0.0.1"
    In /usr/local/ispconfig/server/cron_daily.php seeems to be important this "yesterday" prefix.

    Code:
    foreach($records as $rec) {
      //$yesterday = date('Ymd',time() - 86400);
      $yesterday = date('Ymd', strtotime("-1 day", time()));
    
      $log_folder = 'log';
      if($rec['type'] == 'vhostsubdomain') {
      $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($rec['parent_domain_id']));
      $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $rec['domain']);
      if($subdomain_host == '') $subdomain_host = 'web'.$rec['domain_id'];
      $log_folder .= '/' . $subdomain_host;
      unset($tmp);
      }
      $logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log');
      if([email protected]_file($logfile)) {
      $logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log.gz');
      if([email protected]_file($logfile)) {
      continue;
      }
      }
      $web_folder = ($rec['type'] == 'vhostsubdomain' ? $rec['web_folder'] : 'web');
      $domain = escapeshellcmd($rec['domain']);
      $statsdir = escapeshellcmd($rec['document_root'].'/'.$web_folder.'/stats');
      $awstats_pl = $web_config['awstats_pl'];
      $awstats_buildstaticpages_pl = $web_config['awstats_buildstaticpages_pl'];
    
      $awstats_conf_dir = $web_config['awstats_conf_dir'];
      $awstats_website_conf_file = $web_config['awstats_conf_dir'].'/awstats.'.$domain.'.conf';
    
      if(is_file($awstats_website_conf_file)) unlink($awstats_website_conf_file);
    
      $sql = "SELECT domain FROM web_domain WHERE (type = 'alias' OR type = 'subdomain') AND parent_domain_id = ".$rec['domain_id'];
      $aliases = $app->db->queryAllRecords($sql);
      $aliasdomain = '';
    
      if(is_array($aliases)) {
      foreach ($aliases as $alias) {
      $aliasdomain.= ' '.$alias['domain']. ' www.'.$alias['domain'];
      }
      }
    if(!is_file($awstats_website_conf_file)) {
      $awstats_conf_file_content = 'Include "'.$awstats_conf_dir.'/awstats.conf"
    LogFile="/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log"
    SiteDomain="'.$domain.'"
    HostAliases="www.'.$domain.' localhost 127.0.0.1'.$aliasdomain.'"';
      file_put_contents($awstats_website_conf_file, $awstats_conf_file_content);
      }
    
      if([email protected]_dir($statsdir)) mkdir($statsdir);
      if(is_link('/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log')) unlink('/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log');
      symlink($logfile, '/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log');
    
      $awmonth = date("n");
      $awyear = date("Y");
    
      if (date("d") == 1) {
      $awmonth = date("m")-1;
      if (date("m") == 1) {
      $awyear = date("Y")-1;
      $awmonth = "12";
      }
      }
    
    BTW this is the cron log
    Code:
    Wed Jan 21 00:30:05 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client5/web9
    Wed Jan 21 00:30:05 CET 2015 sh: mailq: command not found
    Wed Jan 21 00:30:07 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client7/web21
    Wed Jan 21 00:30:15 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client15/web10
    Wed Jan 21 00:30:24 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client4/web11
    Wed Jan 21 00:30:29 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client6/web12
    Wed Jan 21 00:31:27 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client17/web19
    Wed Jan 21 00:31:41 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client3/web16
    Wed Jan 21 00:31:49 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client12/web17
    Wed Jan 21 00:31:55 CET 2015 chattr: Operation not permitted while setting flags on /var/www/clients/client2/web22
    New site is /var/www/clients/client11/web44, so this errors are not awstats-related.
     
    Last edited: Jan 21, 2015
  7. Fabrizio

    Fabrizio New Member

    HI!!!!!!!!!!!!!!!!!!!!!

    Don't know why.... but i've commended script cron_daily.php like this

    Code:
      $logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log');
      if([email protected]_file($logfile)) {
      $logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log.gz');
      if([email protected]_file($logfile)) {
      ##continue; <<< here new comment >>>
      }
      }
    And now Works :D
    but... why?!?!?! lol

    edit: data are not updated xD
    it was generated with data of 21 Jan 2015 - 09:42
     
  8. Fabrizio

    Fabrizio New Member

    Hi i've found the problem, so i post in this thread:
    my VPS provider haven't give me mount permission, so the logfile dir located at fstab, are not mounted in the correct dir and this issue happens.
    I will change this server in a OpenVZ container, which can do that.
    Regards

    EDIT: post can ble closed
     

Share This Page