Forum: NGINX separate access log for vhost?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Max (Guest)
on 2009-02-04 07:44
(Received via mailing list)
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
Dan Dascalescu (Guest)
on 2009-02-04 08:03
(Received via mailing list)
> 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/SeparateErrorLoggingPe...

Dan
Max (Guest)
on 2009-02-04 08:22
(Received via mailing list)
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.invalid<removed_email_address@domain.invalid>
Igor S. (Guest)
on 2009-02-04 08:33
(Received via mailing list)
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.
This topic is locked and can not be replied to.