Kong stdout json logging

Hi,

I dont know if this is possible and i have tried a few things without success, the problem that i am facing is that i need to log the request message body from Kong as json. This is needed so Kibana can format the logs correctly.

Our current implementation uses console.log plugin which we tried to override the plugin handler to log out the kong message directly. The problem is that nginx adds some extra fluff to the log message. Example below

2019/04/11 13:10:07 [notice] 46#0: *7577 [lua] handler.lua:18: {"latencies: {“request”:90,“kong”:0,“proxy”:-1}}
, context: ngx.timer, client: 172.29.0.1, server: 0.0.0.0:8000

This means that Kibana cannot figure out the json within that log message and therefore ignores it.
I have tried to create my own nginx template with its own log_format but it seems that i cannot override the main formatter as its part of the . There is probably good reason for that, i just want a way that i can print the json to stdout from Kong plugin directly?

1 Like