Two things I would like:
When a tx occurs, if Kong is the one rejecting it (invalid creds/user not authorized) etc. and is including that as its message: “kong error here” json response, a way to capture that Kong generated error message body and log the short string in my http log plugin. These guys are the errors Kong throws I am talking about:
Other thing I want to log are the nginx errors on proxying for a given tx, specifically the l4 errors around upstream timeouts, upstream prematurely closed connection while reading response headers, all manner of upstream errors when Kong and the backend are trying to talk . I currently log things like l4 errors to the docker stdout so I see the l4/nginx errors in terminal(This is not effective, especially under load and lots of errors, terminal is way too chatty to follow coherently), but does OpenResty or Kong’s PDK expose what I am looking for here as some sort of getter ngx.{error_msg_variable}? :
--Include this one in my http log plugin(with some of the extraneous message fat trimmed off probably)
2018/11/18 14:32:38 [error] 33#0: *11974109 upstream timed out (110: Operation timed out) while reading response header from upstream, client: ip_here, server: kong, request: "POST /api/backend/service/servicename/v1.0 HTTP/1.1", upstream: "https://ip_here:port/api/backend/service/servicename/v1.0", host: "gateway.company.com"
--Ignore this one in my http log plugin(it is my http log plugin throwing an error in this example though :) )
2018/11/18 14:42:05 [error] 32#0: *11983636 [lua] sender.lua:76: send(): failed request to splunk.company.com:443: closed, context: ngx.timer, client: ip_here, server: 0.0.0.0:8443
Gonna try to add the additional info to my plugin here: https://github.com/Optum/kong-splunk-log, and maybe to Kong’s own basic.lua log serializer if they would want that as a PR after I test it out on my own.
https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/errlog.md I saw this which may help grabbing these l4 errors, but was hoping I could get away without having to modify Kong to support this desired logic.
Thanks,
Jeremy