[SOLVED] different log locations

Discussion in 'Installation/Configuration' started by Tomislav Aurednik, May 12, 2017.

  1. @till is it possible to have different log location for websites. A non bind location. That the logs are stored in the /var/www/website/log folder and not in /var/log/ispconfig/httpd/website/. Is it also possible to dissable writing the mount into the fstab for logs?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    No, at least not without changing the ISPConfig source code.
     
  3. yeah... I figured out that much. Any advice where to look in the code?
     
  4. Changes:
    ErrorLog /var/www/<tmpl_var name='domain'>/log/error.log in /usr/local/ispconfig/server/conf/vhost.conf.master
    /usr/local/ispconfig/server/lib/classes/cron.d/150-awstats.inc.php

    commented out everything with fstab and edited with /log in /usr/local/ispconfig/server/plugins-available/apache2_plugin.inc.php
     
  5. OK... the site is created, the log folder is created in /var/www/.$domain./log, the error log works. The vhost file for has the correct path to error.log. It does not write anything in fstab so pacemaker can unmoun drbd partitions with no problem.
    I just can't get the access.log to work. For access log all functions that I found create it to $res['document_root'].$log_dir and document_root is gotten from the DB where it is /var/www/clients/cli.../web../
     
  6. I nearlly got it working but not the correct way! In /usr/local/ispconfig/server/conf/vhost.conf.master after ErrorLog I added:
    "CustomLog /var/www/<tmpl_var name='domain'>/log/access.log combined"
    This creates a access.log file in correct folder and vlogger writes into it. But this doesn't work like your does where it creates symlink access.log that points to the file timstamp-access.log.
    I also changed in /usr/local/ispconfig/server/conf/apache_ispconfig.conf.master the line to
    CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m%d-access.log\" /var/www" combined_ispconfig env=!dontlog
    but it does nothing or at least I don't see if it does something.

    I really need some help here. This and the copying of users between nodes and the HA will probbably be working.
     
  7. @till can you please give me any advice for the location of the code that is used for Apache2 and vlogger to log into /var/log/ispconfig/https/<domain>/log/. In nginx I see that is in the nginx_vhost.conf.master. I created the same in the apache vhost template but it doesn't work as it needs to, so that it creates symlink access.log to the file %Y%m%d-access.log.
    I changed the folders in 150-awstats.inc.php file for the logs so the awstats functions should work, after I get it working.
    It's no problem for me program functions or reprogram functions to create the initial log file, but I'll need the location of the code or at least what files are used in the proccess.
    I copyed the whole /usr/local/ispconfig folder from the server to my pc and using dreamweaver to search in it, but I'm not finding the code. :/
    Can you any one help, I'm running out of time for finishing the project and getting the servers up.
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    The code location is the vlogger code itself. The changes that you made in the apache config just created a second custom log file as far as I see but it does not use vlogger, so logs are not rotated.
     
  9. THANK YOU... but I changed the vlogger settings in: /usr/local/ispconfig/server/conf/apache_ispconfig.conf.master
    CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m%d-access.log\" /var/www" combined_ispconfig env=!dontlog
    I'm looking at the /usr/local/ispconfig/server/scripts/vlogger file. I see that it's all defined here. Now I only have to figure out where and how is it getting data into the variables my $LOGDIR and $vhost (probbably a lot more than only this 2).
    Really appreciate the help, now at least I know where to look.
     
  10. Ok access.log works now as well or al least it works in the beggining when the new site is accessed it creates the log and the symlink for it. The changes were needed in /etc/apache2/sites-avalible/ispconfig.conf, the CustomLog to /var/www and in the vlogger script adding log to vhost "{vhost}/log". Hope that the rotation will work as well.
     
  11. The error.lor, access.log and log rotation work. The old logs are getting compressed and the stats work also.
     
    till likes this.
  12. Problem that appears with logs, drbd and ispconfig. On the secondary node the /var/log/ispconfig/ispconfig.log and /var/log/ispconfig/cron.log just increse in size! 2 days and it was on 7GB because the cronjob starts the scripts every minute and there are no files and no DB so it floods the log with errors.
    The fix is to remove the cronjob lines in crontab -e and write a simple script and put that into ctontab -e

    #!/bin/bash
    if [ -d /var/lib/mysql/dbispconfig ]; then
    /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
    fi
     

Share This Page