Hi,

I remember deciding that having two different VirtualHosts writing into the
same logfile was not a good idea for my setup and then forgot that it could
be done. I've gone back an examined mod_log_confic.c and it looks like my
first answer was misleading.

Basically, you can specify logging directives in different VirtualHosts
which write into the same logfile (with possibly different formats), but
there are two concerns:

(1) Even though you are writing into the same file from the same process,
Apache opens the file twice - once for each logging directive that it sees.
This uses up double the file descriptors, which can be a concern if your
setup has lots of VirtualHosts like mine.

See: http://www.apache.org/docs/vhosts/fd-limits.html

Theoretically, Apache could be smart about this and only open the file once.
This just needs some programmer to spend the time to implement it.

 (2) If you have log buffering turned on to improve performance, the records
written to the logfile will not be in the correct time order. The buffering
will tend to chop them up, so you have a few from one VirtualHost, and then
a few from the other VirtualHost. The individual chunks will be in date
order, but the individual lines are not longer in date order. Some log file
summarizer programs will balk at this.

Apache maintains the buffers so that it will never split a log line between
two writes. Otherwise, the two independent buffers would clash and produce
corrupt log lines.

Buffered logs are disabled by default, but added with the "-DBUFFERD_LOGS"
compile time option.

I apologize for tossing some misleading information out there. I hope this
clears everything up.

 - David Harris
   Principal Engineer, DRH Internet Services


-----Original Message-----
From:   [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Roman Maeder
Sent:   Tuesday, February 16, 1999 2:29 PM
To:     [EMAIL PROTECTED]
Subject:        Re: one log file question


[EMAIL PROTECTED] said:
> Different logfiles are required for SSL and the non-SSL connections
> because you have two different VirtualHost sections, and the logging
> commands are per-VirtualHost.

[EMAIL PROTECTED] said:
> I have often used the same TransferLog entry in two different <Virtual
> Host  ...> entries without problem.  ErrorLog as well.  This will have
> the effect of  combining log messages.

I've done the same. Is specifying the same log file in two different
virtual servers officially OK, or were we just lucky?

If this works I intend to specify the same file, but use a different
log format in the SSL virtual host which will append the SSL-specific
fields to the end of the normal combined log file. This way I hope that
normal logfile analysis will work on the file, and if I ever need to
look at the SSL-specific stuff it is still there.

Roman Maeder

______________________________________________________________________
Apache Interface to SSLeay (mod_ssl)   www.engelschall.com/sw/mod_ssl/
Official Support Mailing List               [EMAIL PROTECTED]
Automated List Manager                       [EMAIL PROTECTED]

______________________________________________________________________
Apache Interface to SSLeay (mod_ssl)   www.engelschall.com/sw/mod_ssl/
Official Support Mailing List               [EMAIL PROTECTED]
Automated List Manager                       [EMAIL PROTECTED]

Reply via email to