Bug 990837 - while loging errors, nginx does not interpolate ${host}
Summary: while loging errors, nginx does not interpolate ${host}
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: nginx
Version: 19
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Nobody's working on this, feel free to take it
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 996006 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-01 05:41 UTC by Renich Bon Ciric
Modified: 2020-11-05 09:55 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-08-26 18:19:26 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Renich Bon Ciric 2013-08-01 05:41:20 UTC
Description of problem:
If you use:

# /etc/nginx/include.d/log_debug.conf 
access_log /var/log/nginx/${host}-access.log;
error_log /var/log/nginx/${host}-error.log debug;

Your access log will interpolate ${host}; while not interpolating it on the error log.

You end up with a file called:  ${host}-error.log


Version-Release number of selected component (if applicable):
nginx-1.4.1-1.fc19.x86_64


How reproducible:
Set up some configuration and add this line inside server {} for the error log to use the host variable:

access_log /var/log/nginx/${host}-access.log;
error_log /var/log/nginx/${host}-error.log debug;

Try making it err (generate errors). 


Actual results:
You will end with a proper access file; called, for example: example.tld-access.log and the ${host}-error.log file.


Expected results:
You should see example.tld-access.log and example.tld-error.log


Additional info:
IMHO, this should go upstream. Just wanted some confirmation,

Comment 1 Jamie Nguyen 2013-08-26 18:19:26 UTC
Sorry for the extremely late reply. This isn't a bug. The upstream documentation does not state that the error_log directive supports variables:

http://nginx.org/en/docs/ngx_core_module.html#error_log

Whereas the access_log is documented to support variables:

http://nginx.org/en/docs/http/ngx_http_log_module.html#access_log

Comment 2 Jamie Nguyen 2013-08-26 18:22:01 UTC
*** Bug 996006 has been marked as a duplicate of this bug. ***

Comment 3 Renich Bon Ciric 2013-08-27 11:12:49 UTC
As reference; this external bug:
https://mail.google.com/mail/u/0/?shva=1#inbox/140bca562f7f7690

Comment 4 Jamie Nguyen 2013-08-27 14:46:55 UTC
(In reply to Renich Bon Ciric from comment #3)
> As reference; this external bug:
> https://mail.google.com/mail/u/0/?shva=1#inbox/140bca562f7f7690

I don't think you meant to give a link to your gmail inbox?

Comment 5 Renich Bon Ciric 2013-08-27 15:46:19 UTC
(In reply to Jamie Nguyen from comment #4)
> (In reply to Renich Bon Ciric from comment #3)
> > As reference; this external bug:
> > https://mail.google.com/mail/u/0/?shva=1#inbox/140bca562f7f7690
> 
> I don't think you meant to give a link to your gmail inbox?

errr... sorry; http://trac.nginx.org/nginx/ticket/404

Comment 6 Jamie Nguyen 2013-08-27 16:39:20 UTC
Thanks for chasing this up upstream, Renich.

Just posting the upstream response here for posterity:

Maxim Dounin wrote:
> The error_log directive doesn't support variables,
> and it's highly unlikely it will - as error log is
> something needed to log errors, and errors may
> happen, in particular, while interpolating variables.


Note You need to log in before you can comment on or make changes to this bug.