# Dynamic error\_log location using regex captures

**URL:** <https://www.ruby-forum.com/t/dynamic-error-log-location-using-regex-captures/224267>\
**Category:** NGINX\
**Created:** [November 6, 2012, 6:40am UTC](https://www.ruby-forum.com/t/dynamic-error-log-location-using-regex-captures/224267 "2012-11-06T06:40:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [November 6, 2012, 6:40am UTC](https://www.ruby-forum.com/t/dynamic-error-log-location-using-regex-captures/224267/1 "2012-11-06T06:40:55Z")

</div>

Why can’t I use a dynamic error\_log location like I do with access\_log?  
Example config:

server\_name ~^(?.+).my-domain.com$;

root /srv/www/accounts/$username/app;

access\_log /var/log/nginx/accounts/$username/access.log;  
error\_log /var/log/nginx/accounts/$username/error.log;

This does not work, since for some reason nginx chokes out on the  
dynamic  
error\_log location. Feature request?

Posted at Nginx Forum:

> **[Dynamic error\_log location using regex captures](https://forum.nginx.org/read.php?2,232516,232516#msg-232516)**
>
> Why can't I use a dynamic error\_log location like I do with access\_log? Example config: server\_name ~^(?\<username\>.+)\\.my-domain\\.com$; root /srv/www/accounts/$username/app; access\_log /var/log/nginx/accounts/$username/access.log; err

---

<div class="post-metadata">

**Author:** ![justin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3ab097/32.png) [@justin](https://www.ruby-forum.com/u/justin)\
**Post date:** [November 6, 2012, 1:34pm UTC](https://www.ruby-forum.com/t/dynamic-error-log-location-using-regex-captures/224267/2 "2012-11-06T13:34:03Z")

</div>

On Tuesday 06 November 2012 09:40:34 justin wrote:

> Why can’t I use a dynamic error\_log location like I do with access\_log?  
> […]

Because it is “error\_log” that may contain critical errors, therefore it  
must  
always be accessible.

wbr, Valentin V. Bartenev

–

> **[F5 NGINX: Built for cloud-native apps. Ready for AI traffic.](https://www.f5.com/products/nginx)**
>
> Deliver modern applications with NGINX. Explore high-performance load balancing, API gateways, and web server solutions trusted by top global enterprises.

> **[nginx: donation](http://nginx.org/en/donation.html)**
