Possible to get more detailed logs to STDOUT?

We have Kong (0.11.1) running on Kubernetes. We use OMS-agent to send the logs (stdout/stderr) to a central location. And this is working fine. Currently when Kong handles and API call, it logs the request URI and the response code. For normal operation this is sufficient but for troubleshooting purposes it would be nice to have more data in the logs, such as request headers etc.
I tried the TCP/UDP/File log plugins and they seem to have the needed information in the output but is it possible to have similar information directly to stdout with some existing plugin so that all our logs would go to central location via same route? Preferably something that could be just turned on for the time that the troubleshooting activities are ongoing and after that turned off.


Currently not possible. Logging plugins will give you traffic logs (including request/response headers). It is worth noting that you can customize the access_log directive of NGINX to a format of your choosing (see the NGINX documentation).

A possible workaround would be to update the proxy_access_log Kong configuration value. I haven’t tried but something like this could work:

# kong.conf
proxy_access_log = logs/proxy_access.log '$remote_addr - [$time_local]  "$request" $status "$http_user_agent"'

Give it a try.

You can also use a custom NGINX template for more fine grained control or if the above solution doesn’t work for some reason (and if not, a pull request would be welcome!).

I think I posted a similar thread a few weeks back, check out - https://github.com/edenlabllc/kong-plugin-stdout-log . I used it for awhile before switching to logging to splunk. Works like a charm and i think meets your use case!

Yes, thanks. I tried the plugin and it was exactly what I needed.

Glad to hear! Hope it works well for yah bud.

I have configured the stdout-log plugin in my kong cluster running on aws ecs containers. Also configured the cloudwatch but dont see any logs in the cloudwatch. Not sure what i am missing.