Hello!
On Sat, Jun 28, 2014 at 1:58 PM, Gordon Madarm wrote:
> I want to conditionally log the entire HTTP request/response (including
> request headers, POST body, response headers and response body) to a
> separate log file. An example condition for logging is if a given keyword is
> found anywhere within the request headers or body. I could use ngx.log() for
> this but would need to modify ngx_log.h to bypass the hard-coded 2048 byte
> limitation. Is there a better way to implement this?
>
File-based logging is blocking due to blocking normal file syscalls
and nginx's error logging is especially expensive in that it disables
buffering completely and should only be used for true errors and
debugging. Better log to sockets, for example,
https://github.com/cloudflare/lua-resty-logger-socket#name
Regards,
-agentzh