Separate access log for vhost?


#1

Hello,

My conf file is something like this:

server {
    listen      12.12.12.1:80;
    listen      12.12.12.2:80;
    listen     12.12.12.3:80;
    server_name _*;

All my sites are pointed to the same directory (I use wordpress and it
allows you to have one installation for multiple sites).

The problem is I can have one access log only:

    access_log  path/host.access.log  main;

Can I separate access log for different vhosts? Something like:
access_log
path/$host.access.log main; is it possible?

Thanks.

Max
Hello,

My conf file is something like this:

server {
    listen      12.12.12.1:80;
    listen      12.12.12.2:80;
    listen     12.12.12.3:80;
    server_name _*;

All my sites are pointed to the same directory (I use wordpress and it
allows you to have one installation for multiple sites).

The problem is I can have one access log only:

    access_log  path/host.access.log  main;

Can I separate access log for different vhosts? Something like:
access_log
path/$host.access.log main; is it possible?

Thanks.

Max


#2

Can I separate access log for different vhosts? Something like: access_log
path/$host.access.log main; is it possible?

Max, see http://wiki.codemongers.com/SeparateErrorLoggingPerVirtualHost

Dan


#3

Hello,

Thanks for the reply.

Yes, I understand if I have separate server { , I can have different
access
logs. But I don’t have separate server { for each domain. I just set the
ip.

Max

On Wed, Feb 4, 2009 at 1:56 PM, Dan Dascalescu
<removed_email_address@domain.invalidremoved_email_address@domain.invalid


#4

On Wed, Feb 04, 2009 at 02:16:40PM +0800, Max wrote:

Hello,

Thanks for the reply.

Yes, I understand if I have separate server { , I can have different access
logs. But I don’t have separate server { for each domain. I just set the ip.

In 0.7.x you may use variables in access_log path:

 access_log  /path/to/$host.access.log;

However, nginx tests root path existance for every access, as some one
may
easy create remotely a lot of such logs.