[SOLVED] Log Rotation dont work

Discussion in 'General' started by Petruzzo, Apr 8, 2020.

  1. Petruzzo

    Petruzzo New Member

    Hi all,
    from some weeks the rotation of the logs by vhist dont work.
    this is the entry in a log directory
    Code:
    [[email protected]*** log]# ll
    totale 419388
    -rw-r--r-- 1 root root   242181 18 feb 00.03 20200216-access.log.gz
    -rw-r--r-- 1 root root   377063 19 feb 00.04 20200217-access.log.gz
    -rw-r--r-- 1 root root   334310 20 feb 00.04 20200218-access.log.gz
    -rw-r--r-- 1 root root   381589 21 feb 00.04 20200219-access.log.gz
    -rw-r--r-- 1 root root   378731 22 feb 00.04 20200220-access.log.gz
    -rw-r--r-- 1 root root   423712 23 feb 00.04 20200221-access.log.gz
    -rw-r--r-- 1 root root   200436 24 feb 00.04 20200222-access.log.gz
    -rw-r--r-- 1 root root  1334018 25 feb 00.04 20200223-access.log.gz
    -rw-r--r-- 1 root root  2202176 26 feb 00.05 20200224-access.log.gz
    -rw-r--r-- 1 root root  3198016 27 feb 00.07 20200225-access.log.gz
    -rw-r--r-- 1 root root  2402466 28 feb 00.06 20200226-access.log.gz
    -rw-r--r-- 1 root root 18853429 27 feb 23.58 20200227-access.log
    -rw-r--r-- 1 root root   690193  1 mar 00.04 20200228-access.log.gz
    -rw-r--r-- 1 root root   781066  2 mar 00.03 20200229-access.log.gz
    -rw-r--r-- 1 root root  1315903  3 mar 00.03 20200301-access.log.gz
    -rw-r--r-- 1 root root   734374  4 mar 00.06 20200302-access.log.gz
    -rw-r--r-- 1 root root  1124852  5 mar 00.03 20200303-access.log.gz
    -rw-r--r-- 1 root root   992892  6 mar 00.03 20200304-access.log.gz
    -rw-r--r-- 1 root root   806826  7 mar 00.04 20200305-access.log.gz
    -rw-r--r-- 1 root root   506867  8 mar 00.03 20200306-access.log.gz
    -rw-r--r-- 1 root root   553463  9 mar 00.03 20200307-access.log.gz
    -rw-r--r-- 1 root root   479264 10 mar 00.04 20200308-access.log.gz
    -rw-r--r-- 1 root root   855603 11 mar 00.04 20200309-access.log.gz
    -rw-r--r-- 1 root root   729860 12 mar 00.05 20200310-access.log.gz
    -rw-r--r-- 1 root root   561254 13 mar 00.04 20200311-access.log.gz
    -rw-r--r-- 1 root root   519504 14 mar 00.06 20200312-access.log.gz
    -rw-r--r-- 1 root root   583277 15 mar 00.04 20200313-access.log.gz
    -rw-r--r-- 1 root root   317533 16 mar 00.04 20200314-access.log.gz
    -rw-r--r-- 1 root root   238465 17 mar 00.04 20200315-access.log.gz
    -rw-r--r-- 1 root root   549588 18 mar 00.04 20200316-access.log.gz
    -rw-r--r-- 1 root root 16067515 17 mar 23.59 20200317-access.log
    -rw-r--r-- 1 root root 22453310 18 mar 23.59 20200318-access.log
    -rw-r--r-- 1 root root 28554048 19 mar 23.59 20200319-access.log
    -rw-r--r-- 1 root root 46271180 20 mar 23.59 20200320-access.log
    -rw-r--r-- 1 root root 26281787 21 mar 23.59 20200321-access.log
    -rw-r--r-- 1 root root 24058005 22 mar 23.59 20200322-access.log
    -rw-r--r-- 1 root root 13863345 23 mar 23.59 20200323-access.log
    -rw-r--r-- 1 root root 19913230 24 mar 23.59 20200324-access.log
    -rw-r--r-- 1 root root 11590182 25 mar 23.59 20200325-access.log
    -rw-r--r-- 1 root root  9129276 26 mar 23.59 20200326-access.log
    -rw-r--r-- 1 root root  8251299 27 mar 23.59 20200327-access.log
    -rw-r--r-- 1 root root 24092758 28 mar 23.58 20200328-access.log
    -rw-r--r-- 1 root root  9862815 29 mar 23.58 20200329-access.log
    -rw-r--r-- 1 root root 15083739 30 mar 23.58 20200330-access.log
    -rw-r--r-- 1 root root 11239715 31 mar 23.59 20200331-access.log
    -rw-r--r-- 1 root root 13725162  1 apr 23.59 20200401-access.log
    -rw-r--r-- 1 root root 17168860  2 apr 23.59 20200402-access.log
    -rw-r--r-- 1 root root 17268033  3 apr 23.59 20200403-access.log
    -rw-r--r-- 1 root root 10187944  4 apr 23.59 20200404-access.log
    -rw-r--r-- 1 root root  6117009  5 apr 23.58 20200405-access.log
    -rw-r--r-- 1 root root 11365806  6 apr 23.59 20200406-access.log
    -rw-r--r-- 1 root root 10394584  7 apr 23.59 20200407-access.log
    -rw-r--r-- 1 root root 13183773  8 apr 18.14 20200408-access.log
    lrwxrwxrwx 1 root root       19  8 apr 00.00 access.log -> 20200408-access.log
    -rw-r--r-- 1 root root   284972  8 apr 17.20 error.log
    -rw-r--r-- 1 root root     1730  9 mar 00.03 error.log.10.gz
    -rw-r--r-- 1 root root     2517  8 mar 00.03 error.log.11.gz
    -rw-r--r-- 1 root root     2202  7 mar 00.04 error.log.12.gz
    -rw-r--r-- 1 root root     2402  6 mar 00.03 error.log.13.gz
    -rw-r--r-- 1 root root     1985  5 mar 00.03 error.log.14.gz
    -rw-r--r-- 1 root root     2621  4 mar 00.06 error.log.15.gz
    -rw-r--r-- 1 root root     2923  3 mar 00.03 error.log.16.gz
    -rw-r--r-- 1 root root    11974  2 mar 00.03 error.log.17.gz
    -rw-r--r-- 1 root root     4938  1 mar 00.04 error.log.18.gz
    -rw-r--r-- 1 root root     2833 28 feb 00.06 error.log.19.gz
    -rw-r--r-- 1 root root     1573 18 mar 00.04 error.log.1.gz
    -rw-r--r-- 1 root root     4766 27 feb 00.07 error.log.20.gz
    -rw-r--r-- 1 root root     5480 26 feb 00.05 error.log.21.gz
    -rw-r--r-- 1 root root     6979 25 feb 00.04 error.log.22.gz
    -rw-r--r-- 1 root root     2654 24 feb 00.04 error.log.23.gz
    -rw-r--r-- 1 root root      769 23 feb 00.04 error.log.24.gz
    -rw-r--r-- 1 root root     1420 22 feb 00.04 error.log.25.gz
    -rw-r--r-- 1 root root     1880 21 feb 00.04 error.log.26.gz
    -rw-r--r-- 1 root root     2049 20 feb 00.04 error.log.27.gz
    -rw-r--r-- 1 root root     1400 19 feb 00.04 error.log.28.gz
    -rw-r--r-- 1 root root     1479 18 feb 00.03 error.log.29.gz
    -rw-r--r-- 1 root root     1481 17 mar 00.04 error.log.2.gz
    -rw-r--r-- 1 root root     1409 16 mar 00.04 error.log.3.gz
    -rw-r--r-- 1 root root     1471 15 mar 00.04 error.log.4.gz
    -rw-r--r-- 1 root root     1590 14 mar 00.06 error.log.5.gz
    -rw-r--r-- 1 root root     1737 13 mar 00.04 error.log.6.gz
    -rw-r--r-- 1 root root     2082 12 mar 00.05 error.log.7.gz
    -rw-r--r-- 1 root root     2343 11 mar 00.04 error.log.8.gz
    -rw-r--r-- 1 root root     3098 10 mar 00.04 error.log.9.gz
    -rw-r--r-- 1 root root    23779 18 mar 00.03 webalizer.conf
    
    someones know what's can be happened?
    thanks
    Edit:
    from 18 Mar I dont see log from cronjob
     
    Last edited: Apr 8, 2020
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Possible reasons:

    - The bind mount for this website in /etc/fstab is missing.
    - The ispconfig cron.sh cronjob in root crontab is not being executed.
     
  3. Petruzzo

    Petruzzo New Member

    The blind of fstab is ok (all vhost has the same problem)
    the cron.sh is called on crontab and i try to execute manually on interface dont see nothing read the file on the system
    Code:
    [[email protected]*** ~]# tail /var/log/ispconfig/cron.log
    mer 8 apr 2020, 21.23.01, CEST finished.
    mer 8 apr 2020, 21.24.01, CEST
    mer 8 apr 2020, 21.24.01, CEST
    mer 8 apr 2020, 21.24.01, CEST finished.
    mer 8 apr 2020, 21.25.02, CEST
    mer 8 apr 2020, 21.25.02, CEST
    mer 8 apr 2020, 21.25.02, CEST finished.
    mer 8 apr 2020, 21.26.01, CEST
    mer 8 apr 2020, 21.26.01, CEST
    mer 8 apr 2020, 21.26.01, CEST finished.
    
     
  4. Steini86

    Steini86 Active Member

    What do you mean by "dont work"? What would you expect? access.log seems to be fine!? error.log is rotated, when it hits 10MB (at least was some years ago, what is your version of ispc?)
    What is your setting of ISPC -> Websites -> Web -> Options -> Logfiles retention time?
     
  5. Petruzzo

    Petruzzo New Member

    my version is 3.1.13
    the retention as 10 days
    on a website i have a 1.5GB error log file this log file is the alarm bell

    Code:
    [[email protected]***log]# ll -h
    totale 1,5G
    -rw-r--r-- 1 root root  19K  9 mar 00.04 20200307-access.log.gz
    -rw-r--r-- 1 root root  15K 10 mar 00.04 20200308-access.log.gz
    -rw-r--r-- 1 root root  15K 11 mar 00.04 20200309-access.log.gz
    -rw-r--r-- 1 root root  17K 12 mar 00.05 20200310-access.log.gz
    -rw-r--r-- 1 root root  15K 13 mar 00.04 20200311-access.log.gz
    -rw-r--r-- 1 root root  16K 14 mar 00.06 20200312-access.log.gz
    -rw-r--r-- 1 root root  17K 15 mar 00.04 20200313-access.log.gz
    -rw-r--r-- 1 root root  17K 16 mar 00.04 20200314-access.log.gz
    -rw-r--r-- 1 root root  20K 17 mar 00.04 20200315-access.log.gz
    -rw-r--r-- 1 root root  20K 18 mar 00.04 20200316-access.log.gz
    -rw-r--r-- 1 root root 184K 17 mar 23.53 20200317-access.log
    -rw-r--r-- 1 root root 153K 18 mar 23.55 20200318-access.log
    -rw-r--r-- 1 root root 271K 19 mar 23.59 20200319-access.log
    -rw-r--r-- 1 root root 252K 20 mar 23.41 20200320-access.log
    -rw-r--r-- 1 root root 450K 21 mar 23.53 20200321-access.log
    -rw-r--r-- 1 root root 195K 22 mar 23.50 20200322-access.log
    -rw-r--r-- 1 root root 1,4M 23 mar 23.59 20200323-access.log
    -rw-r--r-- 1 root root 536K 24 mar 23.55 20200324-access.log
    -rw-r--r-- 1 root root 313K 25 mar 23.54 20200325-access.log
    -rw-r--r-- 1 root root 171K 26 mar 23.43 20200326-access.log
    -rw-r--r-- 1 root root 179K 27 mar 23.59 20200327-access.log
    -rw-r--r-- 1 root root 4,0M 28 mar 23.59 20200328-access.log
    -rw-r--r-- 1 root root 778K 29 mar 23.55 20200329-access.log
    -rw-r--r-- 1 root root 192K 30 mar 23.59 20200330-access.log
    -rw-r--r-- 1 root root 215K 31 mar 23.57 20200331-access.log
    -rw-r--r-- 1 root root 232K  1 apr 23.57 20200401-access.log
    -rw-r--r-- 1 root root 458K  2 apr 23.57 20200402-access.log
    -rw-r--r-- 1 root root 174K  3 apr 23.42 20200403-access.log
    -rw-r--r-- 1 root root 1,1M  4 apr 23.59 20200404-access.log
    -rw-r--r-- 1 root root 486K  5 apr 23.42 20200405-access.log
    -rw-r--r-- 1 root root 166K  6 apr 23.57 20200406-access.log
    -rw-r--r-- 1 root root 1,5M  7 apr 23.59 20200407-access.log
    -rw-r--r-- 1 root root 1,5M  8 apr 23.57 20200408-access.log
    -rw-r--r-- 1 root root 137K  9 apr 08.35 20200409-access.log
    lrwxrwxrwx 1 root root   19  9 apr 00.05 access.log -> 20200409-access.log
    -rw-r--r-- 1 root root 1,5G  8 apr 09.30 error.log
    -rw-r--r-- 1 root root 144K  9 mar 00.04 error.log.10.gz
    -rw-r--r-- 1 root root 144K 18 mar 00.04 error.log.1.gz
    -rw-r--r-- 1 root root 253K 17 mar 00.04 error.log.2.gz
    -rw-r--r-- 1 root root 197K 16 mar 00.04 error.log.3.gz
    -rw-r--r-- 1 root root 171K 15 mar 00.04 error.log.4.gz
    -rw-r--r-- 1 root root 156K 14 mar 00.06 error.log.5.gz
    -rw-r--r-- 1 root root 138K 13 mar 00.04 error.log.6.gz
    -rw-r--r-- 1 root root 109K 12 mar 00.05 error.log.7.gz
    -rw-r--r-- 1 root root 374K 11 mar 00.04 error.log.8.gz
    -rw-r--r-- 1 root root 156K 10 mar 00.04 error.log.9.gz
    lrwxrwxrwx 1 root root   54 18 mar 00.03 yesterday-access.log -> /var/www/clients/client6/web38/log/20200317-access.log
    
    and the symlink for the yesterday-access-log is the same to 20 days
     
  6. Steini86

    Steini86 Active Member

    Update ispc to the newest version, restart apache/nginx and see if problem persists.
     
  7. Petruzzo

    Petruzzo New Member

    Update and restart done
    the logs dont rotate....
     
  8. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    Log rotating happens at night, so you'll need wait until tomorrow to determine that, or run the log rotation manually.
     
  9. Petruzzo

    Petruzzo New Member

    The logs are rotated by ispc internal cron and it'is in root crontab every minute.
    And after the night too the vhost logs dont rotate
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    You are using a very old ISPConfig version. Update the version to the current release and let the update reconfigure the crontab and then wait a day to see if log rotation works after the update.
     
  11. Petruzzo

    Petruzzo New Member

    I had update to 3.1.15p3 last evening.
    This morning the logs as the same.
    I can wait tomorrow
    In the /var/log/ispconfig/cron.log quota checks are also missing
     
  12. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    Do the logs rotate if you run the cron job manually?
    Code:
    php /usr/local/ispconfig/server/cron_debug.php --cronjob=200-logfiles.inc.php
     
  13. Petruzzo

    Petruzzo New Member

    yes they rotated with the command you suggested
     
  14. till

    till Super Moderator Staff Member ISPConfig Developer

    Empty (truncate) the sys_cron table in the dbispconfig database.
     
  15. Petruzzo

    Petruzzo New Member

    I empty the table, the data in the table before the truncate was:

    Code:
    MariaDB [dbispconfig]> select * from sys_cron;
    +-----------------------------------+---------------------+---------------------+---------+
    | name                              | last_run            | next_run            | running |
    +-----------------------------------+---------------------+---------------------+---------+
    | cronjob_mailbox_stats             | 2020-03-18 00:00:02 | 2020-03-19 00:00:00 |       0 |
    | cronjob_monitor_clamav_log        | 2020-03-18 06:20:01 | 2020-03-18 06:25:00 |       0 |
    | cronjob_monitor_cpu               | 2020-03-18 06:20:01 | 2020-03-18 06:25:00 |       0 |
    | cronjob_monitor_database_size     | 2020-03-18 06:20:01 | 2020-03-18 06:25:00 |       0 |
    | cronjob_monitor_disk_usage        | 2020-03-18 06:20:02 | 2020-03-18 06:25:00 |       1 |
    | cronjob_monitor_email_quota       | 2020-03-18 06:15:02 | 2020-03-18 06:30:00 |       0 |
    | cronjob_monitor_fail2ban          | 2020-03-18 06:15:02 | 2020-03-18 06:20:00 |       0 |
    | cronjob_monitor_hd_quota          | 2020-03-18 06:15:02 | 2020-03-18 06:20:00 |       0 |
    | cronjob_monitor_iptables          | 2020-03-18 06:15:02 | 2020-03-18 06:20:00 |       0 |
    | cronjob_monitor_ispconfig_log     | 2020-03-18 06:15:02 | 2020-03-18 06:20:00 |       0 |
    | cronjob_monitor_ispconfig_version | 2020-03-18 06:15:02 | 2020-03-18 06:20:00 |       0 |
    | cronjob_monitor_mail_log          | 2020-03-18 06:15:03 | 2020-03-18 06:20:00 |       0 |
    | cronjob_monitor_mail_queue        | 2020-03-18 06:15:03 | 2020-03-18 06:20:00 |       0 |
    | cronjob_monitor_mem_usage         | 2020-03-18 06:15:03 | 2020-03-18 06:20:00 |       0 |
    | cronjob_monitor_openvz            | 2020-03-18 06:15:03 | 2020-03-18 06:20:00 |       0 |
    | cronjob_monitor_os_version        | 2020-03-18 06:15:03 | 2020-03-18 06:20:00 |       0 |
    | cronjob_monitor_raid              | 2020-03-18 06:15:03 | 2020-03-18 06:20:00 |       0 |
    | cronjob_monitor_rkhunter          | 2020-03-18 00:00:03 | 2020-03-19 00:00:00 |       0 |
    | cronjob_monitor_server            | 2020-03-18 06:15:03 | 2020-03-18 06:20:00 |       0 |
    | cronjob_monitor_services          | 2020-03-18 06:15:03 | 2020-03-18 06:20:00 |       0 |
    | cronjob_monitor_syslog            | 2020-03-18 06:15:03 | 2020-03-18 06:20:00 |       0 |
    | cronjob_monitor_system_update     | 2020-03-18 06:00:02 | 2020-03-18 07:00:00 |       0 |
    | cronjob_awstats                   | 2020-03-18 00:01:58 | 2020-03-19 00:00:00 |       0 |
    | cronjob_webalizer                 | 2020-03-18 00:03:43 | 2020-03-19 00:00:00 |       0 |
    | cronjob_ftplogfiles               | 2020-03-18 00:04:10 | 2020-03-19 00:00:00 |       0 |
    | cronjob_logfiles                  | 2020-04-10 19:53:49 | 2020-04-11 00:00:00 |       0 |
    | cronjob_quota_notify              | 2020-03-18 00:04:14 | 2020-03-19 00:00:00 |       0 |
    | cronjob_openvz                    | 2020-03-18 00:04:14 | 2020-03-19 00:00:00 |       0 |
    | cronjob_backup                    | 2020-03-18 00:04:14 | 2020-03-19 00:00:00 |       0 |
    | cronjob_backup_mail               | 2020-03-18 00:04:14 | 2020-03-19 00:00:00 |       0 |
    | cronjob_bind_dnssec               | 2020-03-18 03:30:02 | 2020-03-19 03:30:00 |       0 |
    | cronjob_cleanup                   | 2020-03-18 06:15:03 | 2020-03-18 06:20:00 |       0 |
    | cronjob_purge_mailboxes           | 2020-03-17 23:30:03 | 2020-03-18 23:30:00 |       0 |
    | cronjob_letsencrypt               | 2020-03-18 03:00:03 | 2020-03-19 03:00:00 |       0 |
    | cronjob_monitor_kernel_version    | 2020-03-18 06:15:02 | 2020-03-18 06:20:00 |       0 |
    +-----------------------------------+---------------------+---------------------+---------+
    35 rows in set (0.00 sec)
    now I wait , the cron.log don't have change (don't log the checks)
     
  16. till

    till Super Moderator Staff Member ISPConfig Developer

    According to that table, the ispconfig cron.sh script was not run once a minute since march 18. Please post the result of:

    crontab -l

    run as root user.
     
  17. Petruzzo

    Petruzzo New Member

    the crontab
    Code:
    [[email protected]*** ~]# crontab -l
    * * * * * /usr/local/ispconfig/server/server.sh 2>&1 | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
    * * * * * /usr/local/ispconfig/server/cron.sh 2>&1 | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
    
     
  18. Petruzzo

    Petruzzo New Member

    Maybe I solved
    I'd execute
    Code:
    /usr/local/ispconfig/server/cron.sh 2>&1 | while read line; do echo `/bin/date` "$line"; done
    for testing only the output of the script with an empty response
    Checking the cron.php file I found the check on the lock file.

    Code:
    [[email protected]**** temp]# ll -a
    totale 20
    drwxr-x---  2 root root 4096 11 apr 15.24 .
    drwxr-x--- 13 root root 4096 10 apr 20.36 ..
    -rwxr-x---  1 root root   45  9 apr 20.32 empty.dir
    -rw-r--r--  1 root root   88 10 apr 08.51 php.ini.md5sum
    -rw-------  1 root root  272 11 apr 15.24 rescue_module_serverconfig.ser.txt
    
    the pid in lock file show an Sleep process by the 18 Mar.

    Code:
    [[email protected]**** temp]# cat .ispconfig_cron_lock
    13810
    [[email protected]**** temp]# ps aux | grep 13810
    root     13810  0.0  0.0 503920  8216 ?        S    mar18   0:00 /usr/bin/php -q -d disable_classes= -d disable_functions= -d open_basedir= /usr/local/ispconfig/server/cron.php
    root     25336  0.0  0.0 112736   964 pts/0    S+   15:14   0:00 grep --color=auto 13810
    
    alter kill the process and delete the lock file the cron jobs work properly

    now I wait if in the next days the crons continue to work
     
  19. Petruzzo

    Petruzzo New Member

    After some days the cron works fine
    the problem are resolved
     
    Steini86 and Jesse Norell like this.

Share This Page