AWStats in multi server

Discussion in 'Installation/Configuration' started by remkoh, Oct 25, 2023.

  1. remkoh

    remkoh Active Member

    I was reading this post about AWStats in a multi server environment and have a follow up question
    https://forum.howtoforge.com/threads/solved-awstats-issue.77699/#post-367784

    What about the stats? As it's part of the shared storage.
    Will stats only be build by the primary webserver and not by the mirror webserver?
    Or will the mirror webserver also be building stats?
    If so, won't that double up the stats?

    I'm thinking of switching to GoAccess in the new environment I'm building.
    Do I need to take anythings else into consideration besides the obvious?
     
  2. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Both will build stats. But if the access.log file is synchronized and used by both servers, it should serve the same stats... Using a simple tool as AWStats for a master-master mirrored webserver config does not make sense to me though ;)
     
  3. remkoh

    remkoh Active Member

    Thanks for the clarification.

    For me it doesn't make sense to have per webserver website stats for the same site. I would want to have total stats, one page to see how the website is doing.
    Webserver statistics will be monitored by Cacti.
     
  4. remkoh

    remkoh Active Member

    For some unknown reason stats aren't propagated.
    I can't find any reason why in logs.

    Nginx logs are rotated and awstats files are renewed every night but all counters remain to be zero and Last Update status keeps saying "Never updated (See 'Build/Update' on awstats_setup.html page)".

    Code:
    php /usr/local/ispconfig/server/cron_debug.php --cronjob=150-awstats.inc.php
    Runs without any errors.
     
  5. remkoh

    remkoh Active Member

    Anyone?
    Pointers on where to look for possible causes would be much appreciated.
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Hmm, not easy to say what the reason is. Do you have some PHP knowledge? If yes, I would recommend looking at the code to get exact awstats command that the plugin is running and then run that command manually to see if you get any errors on the shell.
     
    ahrasis and remkoh like this.
  7. remkoh

    remkoh Active Member

    @till
    My PHP knowledge is fairly basic.
    For the most part I undestand the code so I generally can follow what a script is doing and even do some tweaking if desired.

    Dissecting the awstats command from this script to run it manually is a whole other story :confused:
    Or maybe I'm looking in the wrong file?
    Code:
    /usr/local/ispconfig/server/lib/classes/cron.d/150-awstats.inc.php
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, that's the file. Try this: add the following line right after line 172 (the exec command):

    Code:
    echo $command ."\n";
    Then run:

    php /usr/local/ispconfig/server/cron_debug.php --cronjob=150-awstats.inc.php

    and you should get a list of all awstats commands that were run.
     
    ahrasis likes this.
  9. remkoh

    remkoh Active Member

    That gives me:
    Code:
    /usr/share/awstats/tools/awstats_buildstaticpages.pl -month='11' -year='2023' -update -config='<domain>' -dir='/var/www/clients/client3/web1/web/stats' -awstatsprog='/usr/lib/cgi-bin/awstats.pl'
    Output manually running that command:
    Code:
    Launch update process : "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -update -configdir=
    Build main page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output
    Build alldomains page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=alldomains
    Build allhosts page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=allhosts
    Build lasthosts page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=lasthosts
    Build unknownip page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=unknownip
    Build allrobots page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=allrobots
    Build lastrobots page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=lastrobots
    Build session page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=session
    Build urldetail page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=urldetail
    Build urlentry page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=urlentry
    Build urlexit page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=urlexit
    Build osdetail page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=osdetail
    Build unknownos page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=unknownos
    Build browserdetail page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=browserdetail
    Build unknownbrowser page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=unknownbrowser
    Build downloads page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=downloads
    Build refererse page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=refererse
    Build refererpages page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=refererpages
    Build keyphrases page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=keyphrases
    Build keywords page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=keywords
    Build errors400 page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=errors400
    Build errors403 page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=errors403
    Build errors404 page: "/usr/lib/cgi-bin/awstats.pl" -config=<domain> -staticlinks -month=11 -year=2023 -output=errors404
    23 files built.
    Main HTML page is 'awstats.<domain>.html'.
    
    <domain> is placeholder for the correct domainname.

    Again all files in stats folder are renewed (timestamped when command ran) but all counters remain to be zero and Last Update status keeps saying "Never updated (See 'Build/Update' on awstats_setup.html page)".

    I notice at line 1 -configdir= is empty. Is that correct?
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    That should be fine as the config files are in the global config dir from awstats, so this option does not need to be set. Check the config file of the domain, must be something like /etc/awstats/... if it is there and if it contains the right path to the log file of that site. if that's ok, check the log file to ensure it really contains recent data.
     
  11. remkoh

    remkoh Active Member

    It's there and all seems fine. Comparable to config on an older working server.

    You mean yesterday-access.log in /var/www/<domain>/log/ otherwise known as /var/log/ispconfig/httpd/<domain>/?
    Today it's empty (which is correct) but past days it did contain valid data.
     
  12. remkoh

    remkoh Active Member

    @till Any other suggestions?
     
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    Not really. Maybe you can try to run the command with --configdir=..... set and point it to the directory where the site config files are to see if it makes a difference.
     
  14. remkoh

    remkoh Active Member

    Absolutely no clue why but this night for the first time stats where propagated!

    If've done nothing to any config on the server for days.
    Only thing I've done yesterday is resetting ufw config and reapplying open ports from System >> Firewall in ISPConfig.
    Can't think if any reason why that could be of influence.
     
  15. remkoh

    remkoh Active Member

    Rectification, it's NOT solved.

    Apparently stats started a day earlier, the night from november 10th-11th.
    And since then stats are added to november 10th.

    Makes me think it has something to do with the content of access.log not being interpreted properly.
    Any thoughts?
     

Share This Page