A website was destroying ispconfig!

Discussion in 'General' started by emanuelebruno, Mar 10, 2014.

  1. emanuelebruno

    emanuelebruno Member

    Hi to all,
    this is an incredible story: my customer's web site (with wordpress inside) had a php internal error (caused by a plugin)... for this reason, the linux operative system had created many error log file of 40 GB, wasting all file system space....

    as you know the directory /var/www/clients/client0/web1/log is created by root and the file owner is root so for this reason, the quota setting for the user web1 is not valid...

    Does anybody know how to avoid this problem in the future?

    PS: I believe that this problem is very serious and should be addressed in the guides that talk about how to install ispconfig
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The log directory is not /var/www/clients/client0/web1/log. /var/www/clients/client0/web1/log is just a mount point for asier access to the logs in /var/log/httpd/.... So all log files are in /var/log and its subdirectories, e.g. the access and error logs of the webstes are in /var/log/httpd/domain.tld/ So you can prevent that issue by creating a separate partition for log files on your harddisk.
     
  3. emanuelebruno

    emanuelebruno Member

    Suppose that it is not possibile (for now, I can't reinstall my production server), I have found another solution :



    What do you think about it?

    PS I reccomend to suggest it into your ISPCONFIG GUIDES
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Thats what ispconfig is doing already in the 3.0.5.x releases. The log size is checked every night like logrotate is doing it in the guides you posted above and a new log file gets started when the first one gets too big and the old one gets compressed.
     
  5. emanuelebruno

    emanuelebruno Member

    Thank you for your reply... you say that "the log size is checked every night"... for this reason in 13 hours "a 40 gb file" has been created after the midnight and I don't want that... (calculating 40gb/13hours=near 74 GB in 24 hours!)

    Calculating 10 web site with the same problem = 740 GB !!

    An hacker could infect some "cms plugin" to create this problem to logs files...
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Logrotate, which you posted above, is also checking the filesize once every night.

    you can use some code from crob_daily.php in ispconfig and run it e.g. once every hour, if you like to have the files checked more often.
     
  7. emanuelebruno

    emanuelebruno Member

    Hi till, looking into /etc/logrotate.d/apache2, can I modify the code so it compress the file when it reaches the 250MB size?

    Code:
    /var/log/apache2/*.log {
            size 250M
    	weekly
    	missingok
    	rotate 52
    	compress
    	delaycompress
    	notifempty
    	create 640 root adm
    	sharedscripts
    	postrotate
    		/etc/init.d/apache2 reload > /dev/null
    	endscript
    	prerotate
    		if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
    			run-parts /etc/logrotate.d/httpd-prerotate; \
    		fi; \
    	endscript
    }
    
    Thank you for your reply.
     

Share This Page