Error Log and Custom Log Limit in apache

apache-2.4

I have used the Server version: Apache/2.4.6 (CentOS)

I have written a domain configuration like below

<virtualhost *:80>
ServerName xxx.com
ServerAlias  www.xxx.com
ServerAdmin xxx@yyy.in
DocumentRoot "/var/sentora/hostdata/saravana/public_html/"
ErrorLog "/var/logs/domains/xxx.com-error.log"
CustomLog "/var/logs/domains/xxx.com-access.log" combined
CustomLog "/var/logs/domains/xxx.com-bandwidth.log" common
<Directory "/var/www/xxx/public_html/">
  Options +FollowSymLinks -Indexes
  AllowOverride All
    Require all granted
</Directory>
AddType application/x-httpd-php .php3 .php
ErrorDocument 510 /_errorpages/510.html
ErrorDocument 403 /_errorpages/403.html
ErrorDocument 404 /_errorpages/404.html
ErrorDocument 500 /_errorpages/500.html
DirectoryIndex index.html index.htm index.php index.asp index.aspx index.jsp index.jspa index.shtml index.shtm
# Custom Global Settings (if any exist)

# Custom VH settings (if any exist)

</virtualhost>

if i have configured more domains then apache was not restarted.
if i have commented the ErrorLog and CustomLog then the apache was restarted successfully.
Is there any limitation for ErrorLog and CustomLog count ?
I will need to create a 1000 of domains with similar configuration.Let me know the solution for this problem ?

Best Answer

Typically you set up Apache httpd with a general error log to record start-up errors and then specific log files for each specific Virtual Hosts:

# httpd.conf
# This is the main Apache server configuration file.
...
ErrorLog "/var/log/httpd/error_log"
...
<VirtualHost *:80>
   ServerName example.com
   ErrorLog "/var/logs/domains/example.com-error.log"
   ...
</VirtualHost>
<VirtualHost *:80>
   ServerName example.net
   ErrorLog "/var/logs/domains/example.net-error.log"
   ...
</VirtualHost>

The directories for the log files must exist and and both any existing log files and the directory should be writeable for the Apache httpd startup user.

Start by checking your version of /var/log/httpd/error_log for start up errors and/or messages.


The problem with thousand domains that each contain the three different log files as in your configuration:

ErrorLog "/var/logs/domains/xxx.com-error.log"
CustomLog "/var/logs/domains/xxx.com-access.log" combined
CustomLog "/var/logs/domains/xxx.com-bandwidth.log" common

(especially in combination with the prefork MPM) is that each httpd process needs to open 1000 x 3 = 3000 files just to collect your logs. For instance with a very moderate StartServers 10 that means that 30 thousand open file descriptors are required just to start Apache and even more than that if you get some actual vistors!

Related Topic