Wildcard subdomain - logging

Igor Sysoev is at rambler-co.ru
Fri Apr 11 18:53:14 MSD 2008

On Fri, Apr 11, 2008 at 01:59:54AM -0700, Neil Sheth wrote:

> Hello,
> I'm trying to figure out my logging.  Right now, I have nginx acting
> as a reverse proxy, sending requests to backend web servers running
> apache.  For one part of my site, I have wildcard subdomains - these
> are handled by my htaccess rules for apache.  (I enable something like
> <aname>.mysite.com.  In htaccess, this is rewritten to something like
> /mypage.php?name=<aname>.
> Now, in my nginx access log, no matter what <aname> is, I see "GET /
> ".  Is there any way to get the original request string?  Or, perhaps
> do some regex operation on the log write?  For my stats-tracking, I'd
> like to be able to differentiate between different page hits.  A bit
> at a loss how to get this!

"GET / HTTP/1.1" is original request line: $request_line.
You may additionaly log $uri.
Or add $http_host to your log_format.

Igor Sysoev

More information about the nginx mailing list