Welcome! Log In Create A New Profile

Advanced

NGINX directed logging

Posted by cisaksen 
NGINX directed logging
October 25, 2016 09:33AM
I'm running a drupal multi-site and I want to write to a particular access log file based on the url that comes in. Catch: in the same server block.

I have 1 server block that is handling multiple urls (the drupal multi-site) drupal handles what content is served. I what to test for the urls and have nginx write the access record to a log file associated to that particular url without having to write several server blocks. Is there a way to do this ?

Thanks
Re: NGINX directed logging
October 25, 2016 10:41AM
http://nginx.org/en/docs/http/ngx_http_log_module.html#access_log

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: NGINX directed logging
October 25, 2016 11:20AM
Been reading this - but so far nothing has worked to target a specific log file.

tried this but it's not working as I would have hoped.

access_log /var/log/access-a.log combined if=($host="www.something.com");



Edited 1 time(s). Last edit at 10/25/2016 11:20AM by cisaksen.
Re: NGINX directed logging
October 25, 2016 11:48AM
This will work when used with Map but it won't work for what you're trying to do, the If applies to one logfile only.
And you wanted to associate url's to logfiles which is what the documentation url I send shows.

---
nginx for Windows http://nginx-win.ecsds.eu/
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 77
Record Number of Users: 8 on December 15, 2016
Record Number of Guests: 386 on August 02, 2016
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready