Mike Swearingen
Mike Swearingen

Reputation: 21

How to add access.log to each vhost in apache

Here is my current vhost:

<VirtualHost *:80>
        UseCanonicalName Off
        VirtualDocumentRoot /var/www/%0/public
        <Directory /var/www/%0/public>
                Options Indexes FollowSymLinks Includes ExecCGI
                DirectoryIndex index.php index.html
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory


</VirtualHost>

How can I get a access.log for each %0 vhost?

FYI.. If it matters, this is a debian install.

Upvotes: 2

Views: 6973

Answers (1)

Mike Vranckx
Mike Vranckx

Reputation: 5577

You can add the TransferLog in your VirtualHost definition. Don't forget to restart your Apache service when changing configuration.

<VirtualHost *:80>
        UseCanonicalName Off
        VirtualDocumentRoot /var/www/%0/public

        ErrorLog/var/logs/%0/error.log
        TransferLog /var/logs/%0/access.log

        <Directory /var/www/%0/public>
                Options Indexes FollowSymLinks Includes ExecCGI
                DirectoryIndex index.php index.html
                AllowOverride All
                Order allow,deny
                Allow from all
        </Director>
</VirtualHost>

Upvotes: 2

Related Questions