I was wondering if someone could confirm that requests resulting in a
404
response are by default logged to error.log at error level “error”.
Is that normal, or is there some piece of configuration I am missing
that
will stop them from being logged to error.log? I figured 404s would be
an
un-exceptional event that doesn’t require error logging, but perhaps I’m
simply not handling that situation correctly in my configuration. Worth
double-checking.
Thank you!
Posted at Nginx Forum:
----- Original Message -----
I was wondering if someone could confirm that requests resulting in a
404
response are by default logged to error.log at error level “error”.
Is that normal, or is there some piece of configuration I am missing
that
will stop them from being logged to error.log? I figured 404s would be
an
un-exceptional event that doesn’t require error logging,
Correct.
but perhaps
I’m
simply not handling that situation correctly in my configuration.
Worth
double-checking.
4xx responses are a client errors and don’t go in the error.log
5xx are server errors which do go in the error log.
Hey,
Is that normal, or is there some piece of configuration I am missing that
will stop them from being logged to error.log? I figured 404s would be an
un-exceptional event that doesn’t require error logging, but perhaps I’m
simply not handling that situation correctly in my configuration. Worth
double-checking.
The default behavior is to log such events.
You can change it with the “log_not_found” directive:
http://nginx.org/r/log_not_found
Best regards,
Piotr S.
I might have misread the two answers here, but I get the impression that
they’re saying the exact opposite of each other. Here’s a sample
(redacted)
error message I’m seeing in error.log when doing a GET on a file that
doesn’t exist:
2013/05/18 02:21:27 [error] 11619#0: *417 open()
“/var/www/mysite/foo.html”
failed (2: No such file or directory), client: 123.123.123.123, server:
my.server.com, request: “GET /foo.html HTTP/1.1”, host: “my.server.com”
Just to confirm, should I be seeing the error message above in
error.log, or
did I misconfigure something? I can see a corresponding 404 being logged
in
access.log.
Thanks again.
Posted at Nginx Forum:
Perfect, that clarified it, thank you. I will turn off log_not_found and
stick to having 404s just in my access logs, to be on the safe side.
Posted at Nginx Forum:
----- Original Message -----
I might have misread the two answers here, but I get the impression
that
they’re saying the exact opposite of each other.
If you analysed the responses and what you have I suspect you would of
realised that I was in error and the information you have and the
directive highlighted by Piotr gives you the ability to manipulate the
logging to what you want.
“my.server.com”
Just to confirm, should I be seeing the error message above in
error.log, or did I misconfigure something? I can see a corresponding 404 being
logged in access.log.
A misconfigure assessment depends on what you want. The logs highlight
that 404 do appear in the error log though this doesn’t need to be the
case (
Module ngx_http_core_module )