Help - Search - Members - Calendar
Full Version: Disabling CustomLog and ErrorLog
The Planet Forums > Control Panels > Plesk
mBf
It's weird that I have not found even a single thread discussing disabling CustomLog and ErrorLog, not here in EV1 nor in SW-Soft forums. The reason I want to disable those directives is that I host large number of domains (>800) on my single box, and apache does complain about too much open files.

I know that I can raise the number of open files, but I want to disable the two-per-domain files accesslog and errorlog by disabling the two former directives.

Problim arises of course due to Plesk keeping overwriting /home/httpd/vhosts//conf/httpd.include each time a client modifies something within his/her domain. Using /home/httpd/vhosts//conf/vhost.conf is not a solution also, as it cannot comment out the two lines that contain the two directives.

I have coded a bash shell script and crontabbed it to run every 15 minutes, and it works well. But sometimes, within the 15 minutes period, /usr/local/psa/admin/bin/websrvmng -a reoverwrite the httpd.include files. Below is the script..

CODE
#!/bin/bash



OLDTAG1="CustomLog"

NEWTAG1="        #CustomLog"

OLDTAG2="ErrorLog"

NEWTAG2="        #ErrorLog"



for FILE in /home/httpd/vhosts/*

do

       sed -e "s/.*$OLDTAG1/$NEWTAG1/g" -e "s/.*$OLDTAG2/$NEWTAG2/g" "$FILE/conf/httpd.include" > temp

       mv -f temp "$FILE/conf/httpd.include"

done

service httpd start

exit 0


I looked everywhere for a httpd.include template that Plesk might use to write the configurations files for every domain, but found nothing. Probably its encoded in their bin files.

Any suggestions?

Cheers,
Hossam
firepages
can you not reset the CustomLog directive in the vhost.conf and pipe to /dev/null ?

have to say this plesk rewriting everything in sight has its ups and downs ~
mBf
I have tried something similer, that is having all customlogs pointing to /home/httpd/vhosts/default/.
I have made the myself as it doesnt exist. Next I found /home/httpd/vhosts/default/logs/access_log opened hundreds of times by lsof -p .

I had the idea of using /dev/null instead of regular file, but I suspect that it also will be opened hundreds of times concurrently.

It worth a try nonetheless..

Cheers,
Hossam
mBf
Unfortunately it does not work.
I tried in vhost.conf and vhost_ssl.conf piping through |/dev/null but first apache complained about a permission error and then after updating the permission of /dev/null to 777, apache started to spawn to hundreds of zomby processes and then failed without an error message or traces in log.

It appeared that apache process open both customlog file, errorlog file and /dev/null pipes!

QUOTE
have to say this plesk rewriting everything in sight has its ups and downs


it might have its ups and ups if it was rewriting using a template or even from some entries in database, not via a mysterious hidden "thing".

I hope to have other suggestions.

Cheers,
Hossam
Little Frog
After much research and ending up here reading your thread.. i was quite depressed.

Plesk says they can have a Red Hat Enterprise 3 Default configuration run up to 2000 domains on a server with 4 gigs ram. Well i have that default config along with 2 gigs ram on a dual xeon server... mirror raid array of 200 gig drives.

I am only able to run 650 domains before apache crashes with a segmentation fault... well USE TO...

Scott at EV1 has solved my problems.

See what happened was I added about 200 domains to my server and ran into the same issue with Too Many Files open so i changed my limits EVERYWHERE....
Recompiled PHP
Recompiled IMAP
Recompiled Apache (httpd)

Also had to change my MaxClients in the config file cuse I was maxing out on that to I set it to this.

CODE
########################################

# APACHE SERVER/MAXCLIENT SETTINGS

########################################

ServerLimit 1000



<IfModule prefork.c>

       StartServers            10

       MinSpareServers         10

       MaxSpareServers         80

       MaxClients              1000

       MaxRequestsPerChild     40

</IfModule>



<IfModule worker.c>

       StartServers            2

       MaxClients              600

       MinSpareThreads         25      

       MaxSpareThreads         75

       ThreadsPerChild         25

       MaxRequestsPerChild     10

       # Turned off to use less memory

       # HTTPD memory usage went from 29M to 26M per pid

       ThreadGuardArea off

</IfModule>



# Research this

#ListenBacklog

########################################


The ServerLimit is the important one to note becuase if you don't have that you can only go up to 250 MaxClients before HTTPD will start caughing errors on restart.

So then we were able to go to about 650 standard hosted domains before HTTPD on restart would just say Starting [Failed] - how annoying

Upon doing
CODE
service httpd graceful
then it would tell me the segmentation fault error.

A special tech got on the server and we started debugging and found that one of the additional packages that needs to be recompiled is OpenSSL

So if you are having any of these errors

"Too Many Files Open" - Apache Error Log
"Segmentation Fault" - service httpd graceful (restarting / starting apache)
or problems with Horde and similar problems

==
Errors:

[root@server home]# tail -f /var/log/httpd/error_log
[Wed Nov 03 17:52:43 2004] [warn] RSA server certificate CommonName (CN) `plesk' does NOT match server name!?
[Wed Nov 03 17:52:43 2004] [notice] Digest: generating secret for digest authentication ...
[Wed Nov 03 17:52:43 2004] [notice] Digest: done
[Wed Nov 03 17:52:44 2004] [notice] Apache configured -- resuming normal operations
[Wed Nov 03 17:54:54 2004] [notice] child pid 7210 exit signal Segmentation fault (11)
[Wed Nov 03 17:55:59 2004] [notice] child pid 7207 exit signal Segmentation fault (11)
==

And so on and so on

Follow these updates from SW-SOFT
Read both before performing recompile

Recompiling PHP & IMAP
http://faq.sw-soft.com/index.php?ToDo=view...Id=173&catId=40

Recompiling Apache
http://faq.sw-soft.com/index.php?ToDo=view...Id=134&catId=29

Once you have done these 2 doing OpenSSL functions the same way.

A good resource to find the packages for your architecture is www.rpmfind.net

The OpenSSL package to get and recompile is (as of 3.23.2005)
openssl-0.9.7a-33.12.src.rpm

Red Hat ES: ftp://rpmfind.net/linux/redhat/updates/en...a-33.12.src.rpm

I was told by tech at EV1 that for my system it had to be openssl-0.9.7a-33.12.src.rpm or newer. For older versions of Red Hat I am not sure.

I hope this helps you guys.

If it does drop me a line at ian@littlefroginnovations.com
mBf
Thanks for the help, little frog. But I am not sure..
After the reconfigurations/recompilations, have you managed to run the 2000 domains?
Everytime I play with apache, I have the ability to run more domains that I could actually run before. But at certain number of domains, apache craches again, so I have to play more with apache, adding more domains, until it craches again, and so on..

Actually I see the main solve for the problem is disabling the customlog and errorlog directives. It does not worth it for me to compile everything so I can make use of a feature that I dont need.

Cheers,
Hossam
Little Frog
Yes I do thank you for posting that script I used it as a temporary fix until the openssl was recompiled.

I have not tried going over the 1500 domains (2 gigs of ram)
I suppose I could run a script that auto adds 1000 domains and see how it works.

According to Plesk 2 gigs of ram will run 1500 domains 4 gigs of ram will run 2000 domains.

Here is the URL to see what I am talking about.
http://www.sw-soft.com/en/products/plesk75...5reloaded/reqs/

Domains / Minimum RAM / Minimum Processor
100 / 256 / Pentium II
500 / 512 / Pentium III
1500 / 2000 / dual Pentium III
2000 / 4000 /dual Pentium 4 Xeon

I am going to try tonight to bring my amount of domains to just under 1500
and see how apache likes that.

Currently we are at 780 domains.

How many domains to you have on there?
And whats your hardware.

Again i am running
Dual Pentium 4 Xeon Processors
2 GB Ram
So that would put me in the 1500 domain mark that I can run.


BTW: I re-wrote part of your script to just comment out the ErrorLog and this would also allow the script to run back to back and only insert ONE # instead of just adding one each time it runs.

CODE
#!/bin/bash



# REMOVES # FIRST INCASE THIS IS ALREADY THERE

OLDTAG1="#ErrorLog"

NEWTAG1="ErrorLog"



# COMMENTS OUT ERRORLOG

OLDTAG2="ErrorLog"

NEWTAG2="#ErrorLog"



for FILE in /home/httpd/vhosts/*

do

       sed -e "s/.*$OLDTAG1/$NEWTAG1/g" -e "s/.*$OLDTAG2/$NEWTAG2/g" "$FILE/conf/httpd.include" > temp

       mv -f temp "$FILE/conf/httpd.include"

done

service httpd start

exit 0


I did this so I could run it back to back without error or over stuffing with # before the ErrorLog line.
Secondly I only needed to comment out the ErrorLog not both since cutting out the ErrorLog will cut half the open files out and allow you to increase the limit of domains you can have.

Now here is some of the debugging information the EV1 Tech ran.

CODE
# RUN THE DEBUGGER ON HTTPD IN FAILURE MODE

gdb /usr/sbin/httpd



# httpd crashed when processing this file.

# FIND THE RPM FILE WITH THIS FILE IN IT

rpm -qf /lib/libcrypto.so.4



# Not found so view file

ls -l /lib/libcrypto.so.4



# FILE WAS LINK TO FIND PACKAGE WITH THIS FILE

rpm -qf /lib/libcrypto.so.0.9.7a


I have never used the debugger so i do not know what he typed in inside the gdb command but what ever it was basically was like an strace and gave him enough info to view the libcrypto.so.4 file. This info may also help.
Little Frog
got the info for the debugger.

When you run
CODE
gdb /usr/sbin/httpd


this will open the gnu debugger
once you see
(gdb)
then type
CODE
run

then you should get an error
then type
CODE
bt


This should show you the last 5 lines executed before the script crashed, which for me was when the openssl stuff appeared and how we found out that openssl needed to be recompiled to recognize the new FD settings.

Only useful if httpd is already in failure mode.. meaning not starting.
mBf
Oh that was an old script, it seems that I forget to write a modified versions to add one "#" only to comment directives out:

CODE
#!/bin/bash



OLDTAG1="CustomLog"

NEWTAG1="        #CustomLog"

OLDTAG2="ErrorLog"

NEWTAG2="        #ErrorLog"



for FILE in /home/httpd/vhosts/*

do

       sed -e "s/.*$OLDTAG1/$NEWTAG1/g" -e "s/.*$OLDTAG2/$NEWTAG2/g" "$FILE/conf/httpd.include" > temp

       mv -f temp "$FILE/conf/httpd.include"

done

service httpd restart

exit 0


My hardware configurations is P4 2.8 + 512M Ram and I run more than 2500 domain without the need of recompiling anything, allow more open files, etc.. The script is a temporary fix, and on an ideal world I would run it everytime "/usr/local/psa/admin/websrvmng" runs, using event handlers.

However, once again, if plesk has gave us more control on the httpd.include automatically generated in /home//conf/ there wouldnt have been an issue.

Thanks,
Hossam
Little Frog
I agree with having a httpd.include template that we could edit.

I guess since you do a lot of free hosting (seen one of your posts say that) web stats are not that immportant to you. For me they are which is why I only commented the ErrorLog file. I think if SW-Soft was really to dive into the issue you are having they probably would come back and say it was a RAM issue.

Your suggestions helped me and got me to this point, for that I thank you for your input. I am still going to run my test tonight and see what results I get and how many domains I can add.

I will post here the results I find so you can be updated on my progress.

I like you have been dealing with this issue a long time and would love to see 1500 domains running with out any issues with apache failing due to log files or seg faults.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.