yesterday-access.log Symlink not changed for Debian Squeeze - Missing Awstats Data

Discussion in 'Installation/Configuration' started by snowfly, May 2, 2014.

  1. snowfly

    snowfly Member

    I just noticed this morning that the yesterday-access.log symlink for a whole bunch of websites we host, over multiple servers, did not update, so no awstats data files were generated for the 1st May.

    This only failed for Debian Squeeze servers in our ISPConfig 3.0.5.3 multi-server setup. Servers on debian wheezy worked fine.

    Example issue on squeeze: (as of 2 May 2014)
    /var/log/ispconfig/httpd/example.com/yesterday-access.log -> /var/www/clients/client123/web123/log/20140430-access.log

    You can see the yesterday-access.log incorrectly still points to the 30 April access log file, not the 20140501 log file.
    The timestamp of the above symlink is "May 2 01:07", which shows the ISPConfig cron updated it, but the generated "$yesterday" date is wrong.

    Example on wheezy: (correctly pointing to 1st May)
    /var/log/ispconfig/httpd/example2.com/yesterday-access.log -> /var/www/clients/client321/web321/log/20140501-access.log


    I traced back the ISPConfig daily cron to see where the issue might be, but I can't see anything obvious?
    In /usr/local/ispconfig/server/cron_daily.php, line 280, yesterday's date is generated by:
    PHP:
    $yesterday date('Ymd',strtotime("-1 day"time()));
    Any ideas?

    I wonder if this is left, when the daily ISPConfig cron next runs on 3 May, it will right itself, and the 'yesterday-access.log' symlinks will then correctly link to 2 May.... BUT, then the awstats data lib files will be missing data from 1 May!?

    All our servers (squeeze or wheezy) are in the same timezone, exact same times, using NTP. Only major differences are package versions (e.g. php 5.3 vs 5.4)
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    ensure that you have set the correct timezone (the same timezone that you use in Linux) in both ispconfig config.inc.php files.
     
  3. snowfly

    snowfly Member

    I checked both config files:
    Code:
    /usr/local/ispconfig/interface/lib/config.inc.php
    /usr/local/ispconfig/server/lib/config.inc.php
    And they both had the same:
    PHP:
    $conf['timezone'] = 'UTC';
    This config.inc.php has not been modified on the primary server, or any other linked server in our multi-server setup, so should be from the default install.

    Should I be editing this config file after installing ISPConfig?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    But does your Linux system use UTC as well? If the time zone settings between ispconfig and the linux system differs, then the date calculation for the symlink can be wrong.

    ISPConfig tries to detect the system timezone, but this does not always work, depending on the linux distribution and setup. So its better to check and correct the timezone in ispconfig after install.
     
  5. snowfly

    snowfly Member

    All our systems on ISPConfig are set to Pacific/Auckland (cat /etc/timezone)

    Been running multi-server ISPConfig setup for a number of years now, and never had this problem before, and I'm adding a new server to the group every few months (with fresh ISPConfig install).

    Haven't had to touch config before, so not sure what has changed, and why the yesterday log symlink has all of a sudden failed for our squeeze systems?

    Anyway, I re-ran cron-daily for the effected systems, and that corrected the smylink, so I awstats could correctly be reported, for 1 May.
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    The reason is quite simple and the fix as well, I explained that above. The cronjob is run at 0:30 am, when you have a set a wrong timezone in ispconfig, then the calculation:

    $yesterday = date('Ymd',strtotime("-1 day", time()));

    does not return yesterday, it will return the day before yesterday. So all you have to do to fix that is that you set the system timezone in both config.inc.php files.
     
  7. snowfly

    snowfly Member

    Ok thanks, looks like I'll have to do that to 30+ servers then :(

    Is there not an easy way for the ISPConfig install script to detect the current server timezone, and populate this in config.inc.php?
    So we don't have to remember to do this for every new ISPConfig install we do?
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    ISPConfig ha various methofs implemented in 3.0.5.4 to detect the timezone.
     

Share This Page