Redirect 404 errors to a separate log file

I have been trying for a whole day to figure out how to redirect 404
errors
to a separate log file. I managed to do this in the server directive:

error_page 404 = @404;
location @404 {
error_log /var/log/nginx/404.log;
}

This does write all 404 errors to 404.log, but the problem is that it
also
writes these errors in the default error.log, and I don’t want that. I
want
404 errors to be writtent to only into the 404.log.

Do you have an idea how to do this?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,230087,230087#msg-230087

Hello!

On Fri, Aug 24, 2012 at 04:31:17AM -0400, kustodian wrote:

404 errors to be writtent to only into the 404.log.

Do you have an idea how to do this?

Errors to error_log are logged once they happen, so you can’t
configure separate error_log to log specific errors (in contrast
to access_log).

However you may control whether to log “not found” errors or not -
there is configuration directive “log_not_found” for this, see
http://nginx.org/r/log_not_found.

Maxim D.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs