error.log rotation

Discussion in 'General' started by edopol, Feb 27, 2023.

  1. Hi!
    Weirdly enough, it seems that I've been plagued with the same issue (or at least a very similar one). I've noticed that, for some stupid reason, I was looking at the error.log of one of the websites, and fixing PHP errors on the code... from last year? That baffled me, so I went to see how far back the logs went... ouchie, I had 227 MBytes of logs!

    Also, while the access.log does get rotated on the unmounted filesystems, it does not get compressed, nor are the older logs ever removed. Every day, I just get a brand new YYYYMMDD-access.log every day — which remain on disk, uncompressed, forever!

    And the same seemed to be the case for many, many, many other sites. I cannot say, with precision, if it's a subdirectory vs. main directory issue. I can say that there are just a handful of mount points on /etc/fstab, and these are, indeed, the websites that are being correctly rotated. Thus, the problem comes from the broken mount points — why they got broken in the first place is beyond my knowledge. Indeed, I never noticed that I had logs under /var/www/my.domain.td/log until today... I always looked for anything under /var/log/ispconfig/http/my.domain.tld/ inste ad, which is where I always thought that the logs were supposed to be!

    All right, I guess that I'll need to fix all those mounts manually, and hope that everything works as expected again. Thanks so much for the hints on what to find for and where, it's much appreciated!

    BTW, regarding this link below:

    Unfortunately, that file is reserved for Priority VIP Support only; apparently, we regular users have no permission to see or download it.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Log rotation can not work when the fstab mounts are missing, so you have to recreate them. The logs are mounted into the website as regular users with a chroot would not be able to view them otherwise.

    I moved the post with the helper script to an open forum now.
     
    Gwyneth Llewelyn likes this.
  3. That makes a lot of sense (after your explanation, of course). However, it was a mystery to me why these fstab mounts were missing! Read on...

    Thank you very much!
    I think that this is a script that should be permanently part of ISPConfig :)
    Anyway, this script immediately pointed out what was wrong in my system!
    I'm running Ubuntu 22.04.3 LTS. This helper script (and presumably on earlier versions of ISPConfig3), the filesystems are mounted with the option nobootwait. This, apparently, was a non-standard option for early Ubuntu versions, and one which worked reasonably well; but, at some point in time — possibly when Ubuntu officially moved its system to systemd — it was deprecated (again, perhaps because it's not standard, and would generate conflicts with scripts designed having systemd in mind...).
    That's why @KoS mentioned on a previous post that his /etc/fstab, all of a sudden, was populated with nobootwait — it came from the helper script. Besides that, it works quite well.
    As mentioned, the current version of ISPConfig3 has already replaced nobootwait with nofail, both on /usr/local/ispconfig/server/plugins-available/apache2_plugin.inc.php and /usr/local/ispconfig/server/plugins-available/nginx_plugin.inc.php. This meant that new sites, and old ones tcohat have been extensively reconfigured, did have the correct entry on /etc/fstab. This was what was baffling me — why did it work on some but not all?
    But all the entries for the others did not exist at all, and one possibility was that some other process, not recognising the deprecated nobootwait parameter, promptly deleted the entire line. Why? I have no idea. Which process did that, and how to prevent it from happening in the future? Again, I have absolutely no idea.
    Anyway, after all these changes, I ran:
    Code:
    php /usr/local/ispconfig/server/cron_debug.php --cronjob=200-logfiles.inc.php
    And I can confirm that it finished with no errors, and, as far as I could check, it did rotate all the relevant logs, and even compressed the more recent ones (alas, not the older ones, but that's ok, I can always do that later).
    ---
    As an unrelated issue, which probably ought to get mentioned on a new thread, would it be possible to replace the hard-coded gzip by something else, as we have for the backups? I especially favour brotli compression, but bzip2 would also work as an alternative...
     
  4. KoS

    KoS Member HowtoForge Supporter

    Thanks @Gwyneth Llewelyn for digging into this!
    So would you suggest to replace the nobootwait in fstab with nofail and adapt it in the script?
    Besides that, have you seen my comment regards the directory name for the subdomains? That seems to have changed over time too. Or haven't you had this issue on your side when using the script?
     

Share This Page