NGINX error log format documentation

2019-02-03 00:19发布

问题:

I want to parse NGINX error logs. However, there seems to be no documentation at all, concerning the used log format. While the meaning of some fields like the data is pretty obvious, some are not at all. In addition, I cannot be sure that my parser is complete if I do not have a documentation of all the possible fields. Since it seems you can change the access log format, but not that of the error log, I really have no idea how to get the information I need.

Does anyone know of such a documentation?

回答1:

From reading src/core/ngx_log.c I guess the general error log format seems to be

YYYY/MM/DD HH:MM:SS [LEVEL] PID#TID: *CID MESSAGE

With PID and TID being the logging process and thread id and CID a number identifying a (probably proxied) connection, probably a counter. The *CID part is optional.



标签: logging nginx