Bug 990837 - while loging errors, nginx does not interpolate ${host}
while loging errors, nginx does not interpolate ${host}
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: nginx (Show other bugs)
19
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jamie Nguyen
Fedora Extras Quality Assurance
:
: 996006 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-01 01:41 EDT by Renich Bon Ciric
Modified: 2013-08-27 12:39 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-08-26 14:19:26 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Renich Bon Ciric 2013-08-01 01:41:20 EDT
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 14:19:26 EDT
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 14:22:01 EDT
*** Bug 996006 has been marked as a duplicate of this bug. ***
Comment 3 Renich Bon Ciric 2013-08-27 07:12:49 EDT
As reference; this external bug:
https://mail.google.com/mail/u/0/?shva=1#inbox/140bca562f7f7690
Comment 4 Jamie Nguyen 2013-08-27 10:46:55 EDT
(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 11:46:19 EDT
(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 12:39:20 EDT
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.