# Location based access log

**URL:** <https://www.ruby-forum.com/t/location-based-access-log/210368>\
**Category:** NGINX\
**Created:** [August 5, 2011, 9:18pm UTC](https://www.ruby-forum.com/t/location-based-access-log/210368 "2011-08-05T21:18:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [August 5, 2011, 9:18pm UTC](https://www.ruby-forum.com/t/location-based-access-log/210368/1 "2011-08-05T21:18:45Z")

</div>

Hi all. I’m trying to log request to a specific directory to an  
alternate access\_log. The docs suggest the access\_log can be specified  
in the http, server, or location level. eg:

server {  
access\_log /var/log/nginx/access\_log;  
location /api/ {  
access\_log /var/log/nginx/api.access\_log;  
}  
}

In my case, everything is logged the main access\_log, and although the  
file gets created for the api.access\_log, nothing gets logged to it.

Am I missing something?

Thanks in advanced.  
-Jason

Posted at Nginx Forum:

> **[Location based access log](https://forum.nginx.org/read.php?2,213438,213438#msg-213438)**
>
> Hi all. I'm trying to log request to a specific directory to an alternate access\_log. The docs suggest the access\_log can be specified in the http, server, or location level. eg: server { access\_log /var/log/nginx/access\_log; location /api/ {

---

<div class="post-metadata">

**Author:** ![houseofmore](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e56c9b/32.png) [@houseofmore](https://www.ruby-forum.com/u/houseofmore)\
**Post date:** [August 7, 2011, 1:12pm UTC](https://www.ruby-forum.com/t/location-based-access-log/210368/2 "2011-08-07T13:12:44Z")

</div>

Kinda light on details, will need a more complete config as well as an  
example URI being accessed.

Posted at Nginx Forum:

> **[Re: Location based access log](https://forum.nginx.org/read.php?2,213438,213469#msg-213469)**
>
> Hi all. I'm trying to log request to a specific directory to an alternate access\_log. The docs suggest the access\_log can be specified in the http, server, or location level. eg: server { access\_log /var/log/nginx/access\_log; location /api/ {
