access.log from all websites are not correct rotate

Discussion in 'General' started by RonnyH, Oct 2, 2022.

  1. RonnyH

    RonnyH New Member

    I noticed it only after some time that the log files are no longer rotated properly. I suspect that it is due to the access.log file, since this is not a link to the current file.
    Code:
    ls -l /var/log/ispconfig/httpd/website.de/
    total 1273472
    -rw-r--r-- 1 root root         40 Sep 22 00:03 20220920-access.log.gz
    -rw-r--r-- 1 root root         40 Sep 23 00:03 20220921-access.log.gz
    -rw-r--r-- 1 root root         40 Sep 24 00:03 20220922-access.log.gz
    -rw-r--r-- 1 root root         40 Sep 25 00:03 20220923-access.log.gz
    -rw-r--r-- 1 root root         40 Sep 26 00:03 20220924-access.log.gz
    -rw-r--r-- 1 root root         40 Sep 27 00:03 20220925-access.log.gz
    -rw-r--r-- 1 root root         40 Sep 28 00:03 20220926-access.log.gz
    -rw-r--r-- 1 root root         40 Sep 29 00:03 20220927-access.log.gz
    -rw-r--r-- 1 root root         40 Sep 30 00:03 20220928-access.log.gz
    -rw-r--r-- 1 root root         40 Oct  1 00:03 20220929-access.log.gz
    -rw-r--r-- 1 root root         40 Oct  2 00:03 20220930-access.log.gz
    -rw-r--r-- 1 root root          0 Oct  1 00:00 20221001-access.log
    -rw-r--r-- 1 root root 1211901797 Oct  2 19:50 20221002-access.log
    -rw-r--r-- 1 root root          0 Oct  2 00:00 access.log
    -rw-r--r-- 1 root root   45295125 Oct  2 19:38 error.log
    -rw-r--r-- 1 root root    3804341 Sep 23 00:03 error.log.10.gz
    -rw-r--r-- 1 root root    3655620 Sep 22 00:03 error.log.11.gz
    -rw-r--r-- 1 root root    3749242 Oct  2 00:03 error.log.1.gz
    -rw-r--r-- 1 root root    3410605 Oct  1 00:03 error.log.2.gz
    -rw-r--r-- 1 root root    4445052 Sep 30 00:03 error.log.3.gz
    -rw-r--r-- 1 root root    4504730 Sep 29 00:03 error.log.4.gz
    -rw-r--r-- 1 root root    4310671 Sep 28 00:03 error.log.5.gz
    -rw-r--r-- 1 root root    4071963 Sep 27 00:03 error.log.6.gz
    -rw-r--r-- 1 root root    5278911 Sep 26 00:03 error.log.7.gz
    -rw-r--r-- 1 root root    5836963 Sep 25 00:03 error.log.8.gz
    -rw-r--r-- 1 root root    3688807 Sep 24 00:03 error.log.9.gz
    lrwxrwxrwx 1 root root         53 Oct  2 00:03 yesterday-access.log -> /var/www/clients/client1/web2/log/20221001-access.log
    
    Normally the access.log file should look like this:
    Code:
    lrwxrwxrwx 1 root root         19 Oct  2 20:04 access.log -> 20221002-access.log
    I deleted the access.log file and recreated it manually as a link. The next day the link is gone again and it is a normal 0 byte file again. Could it be that the log file is too large at over a gigabyte? I could not figure out the problem.
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    No mention what OS is on that host, nor is the HTTP server apache or nginx.
    My guess is web server logging configuration has been changed, so it now adds the date to the log file name. If this is desired, logrotate settings should be changed accordingly, so it still rotates the log files after this name change.
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    Check /etc/fstab file, I guess the bind mounts for the log directories might be missing.
     
  4. RonnyH

    RonnyH New Member

    You are right I forgot the important information: OS ist Debian 10, we use Apache as webserver.
    I believe the log file rotation is not performed by the logrotate service.
    After the manual change from yesterday, the logfile from yesterday is linked to the one from today. The access.log file is again a normal file and not a symbolic link. The log file from today actually also contains only data from today. All data from yesterday are deleted. The fstab file looks like it should.
    Code:
    # grep web2 /etc/fstab
    /var/log/ispconfig/httpd/website.de /var/www/clients/client1/web2/log    none    bind,nobootwait    0 0
    
    Code:
    # ls -l /var/www/clients/client1/web2/log
    total 291868
    -rw-r--r-- 1 root root        40 Sep 24 00:03 20220922-access.log.gz
    -rw-r--r-- 1 root root        40 Sep 25 00:03 20220923-access.log.gz
    -rw-r--r-- 1 root root        40 Sep 26 00:03 20220924-access.log.gz
    -rw-r--r-- 1 root root        40 Sep 27 00:03 20220925-access.log.gz
    -rw-r--r-- 1 root root        40 Sep 28 00:03 20220926-access.log.gz
    -rw-r--r-- 1 root root        40 Sep 29 00:03 20220927-access.log.gz
    -rw-r--r-- 1 root root        40 Sep 30 00:03 20220928-access.log.gz
    -rw-r--r-- 1 root root        40 Oct  1 00:03 20220929-access.log.gz
    -rw-r--r-- 1 root root        40 Oct  2 00:03 20220930-access.log.gz
    -rw-r--r-- 1 root root        40 Oct  3 00:03 20221001-access.log.gz
    lrwxrwxrwx 1 root root        19 Oct  3 00:00 20221002-access.log -> 20221003-access.log
    -rw-r--r-- 1 root root 215345435 Oct  3 09:34 20221003-access.log
    -rw-r--r-- 1 root root         0 Oct  3 00:00 access.log
    -rw-r--r-- 1 root root  39941934 Oct  3 09:22 error.log
    -rw-r--r-- 1 root root   3688807 Sep 24 00:03 error.log.10.gz
    -rw-r--r-- 1 root root   4210942 Oct  3 00:03 error.log.1.gz
    -rw-r--r-- 1 root root   3749242 Oct  2 00:03 error.log.2.gz
    -rw-r--r-- 1 root root   3410605 Oct  1 00:03 error.log.3.gz
    -rw-r--r-- 1 root root   4445052 Sep 30 00:03 error.log.4.gz
    -rw-r--r-- 1 root root   4504730 Sep 29 00:03 error.log.5.gz
    -rw-r--r-- 1 root root   4310671 Sep 28 00:03 error.log.6.gz
    -rw-r--r-- 1 root root   4071963 Sep 27 00:03 error.log.7.gz
    -rw-r--r-- 1 root root   5278911 Sep 26 00:03 error.log.8.gz
    -rw-r--r-- 1 root root   5836963 Sep 25 00:03 error.log.9.gz
    lrwxrwxrwx 1 root root        53 Oct  3 00:03 yesterday-access.log -> /var/www/clients/client1/web2/log/20221002-access.log
    
    Code:
    # mount |grep web2
    /dev/sda3 on /var/www/clients/client1/web2/log type ext4 (rw,noatime,nodiratime,errors=remount-ro,jqfmt=vfsv0,usrjquota=quota.user,grpjquota=quota.group)
    
     
  5. pyte

    pyte Well-Known Member HowtoForge Supporter

    You're right, logrotate is not in use here. Logrotation is handled by /usr/local/ispconfig/server/lib/classes/cron.d/200-logfiles.inc.php.
    Linking to the file manually is useless as you have to update the link each time the log rotates.
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    The log files are written by vlogger and also rotated by vlogger, the /usr/local/ispconfig/server/lib/classes/cron.d/200-logfiles.inc.php file only compresses them and removes old files. Maybe you manually change the apache or vhost configuration to write log files that override the global vlogger configuration?
     
  7. RonnyH

    RonnyH New Member

    I did not consciously change settings for logging. Here is the output that points to the access.log in the Apache folder. I didnt see any change like other server:
    Code:
    $ fgrep -ir "access.log" /etc/apache2/
    /etc/apache2/sites-available/ispconfig.conf:CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m%d-access.log\" /var/log/ispconfig/httpd" combined_ispconfig
    /etc/apache2/sites-available/ispconfig.vhost:  # CustomLog /var/log/apache2/access.log combined
    /etc/apache2/sites-available/default-ssl.conf:          CustomLog ${APACHE_LOG_DIR}/access.log combined
    /etc/apache2/sites-available/000-default.conf:  CustomLog ${APACHE_LOG_DIR}/access.log combined
    /etc/apache2/conf-available/other-vhosts-access-log.conf:CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log vhost_combined
    
     

Share This Page