Force Nginx to log error?

Carl Winbäck c at tunnel53.net
Sun Jun 14 15:34:31 UTC 2020


> I'm not sure I understand the question, but how does this sound? I
> use a map to catch requests that I don't want. For instance I return
> a 444 if I receive a "wget".

No, I don’t mean status codes on the HTTP level. Status code 444 is
not an error per se that would be sent to the error log, it is a valid
status code sent from the server to the client. To the client that
might be considered an error, but not to Nginx.

I mean errors on a lower level, i.e. the level of the nginx daemon
itself.

E.g. stuff like this:

2020/06/14 13:13:59 [alert] 700#700: *998 open socket #13 left in connection 11
2020/06/14 13:13:59 [alert] 700#700: *4118 open socket #4 left in connection 13
2020/06/14 13:13:59 [alert] 700#700: *4169 open socket #17 left in connection 16
2020/06/14 13:13:59 [alert] 700#700: aborting

It would be useful to me to be able to trigger such messages, so that
I can verify that they are sent to the right destination.

E.g. if I have the following stanza in my config:

error_log /srv/nginx/error.log warn;

Then messages of the warn/error/crit/alert/emerg levels should be
logged and written to the file /srv/nginx/error.log (a file which is
separate from the access log).

I hope it is clearer now what I meant :)


More information about the nginx mailing list