Keeping Separate Logs for Each Virtual Host


<VirtualHost 192.168.200.3> ServerName vhost1.example.com CustomLog logs/vhost1.example.com_log combined ErrorLog logs/vhost2.example.com_log ....... </Virtual Host>


You can keep separate access logs for each virtual host using a CustomLog directive inside each <VirtualHost> section, as shown in the example.

You can also choose to log the operations of all virtual hosts in the access_log defined in the global server context:

LogFormat "%v %h %l %u %t \"%r\" %>s %b" common_virtualhost CustomLog logs/access_log common_virtualhost


%v will log the name of the virtual host that serves the request. You can then use the tools described in the previous section to process the resulting log file. This may be necessary if you have a large number of virtual hosts.

If you don't want to keep track of the operations of a particular host at all, you can simply use

CustomLog /dev/null





Apache(c) Phrase Book(c) Essential Code and Commands
Apache Phrasebook
ISBN: 0672328364
EAN: 2147483647
Year: 2006
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net