How to log JSON request logs to stdout

259 views
Skip to first unread message

brendan....@gmail.com

unread,
Nov 13, 2017, 7:04:29 PM11/13/17
to Kong
I want to use Kong on kubernetes, and my log collector can gather logs from stdout. Id like these logs to be in JSON, however I dont believe there is a way to have Kong log as JSON to stdout. My current solution is to create a really simple API which logs bodies to stdout, and have kong post all logs there using the HTTP log plugin. 

How can I have Kong write logs as JSON to stdout?

Jeremy Darling

unread,
Nov 13, 2017, 11:20:29 PM11/13/17
to brendan....@gmail.com, Kong
A quick search of both LuaRocks and the official plugins doesn't show anything that supports this.  You could use our (Pearson's) Rewrite plugin (https://github.com/pearsontechnology/kong-rewrite-plugin) to do something like this as long as your aggregator would ignore the malformed lines.  Otherwise you would need to write a log adapter (actually the code for plugins is pretty easy to do look at existing ones for examples).

On Mon, Nov 13, 2017 at 6:04 PM, <brendan....@gmail.com> wrote:
I want to use Kong on kubernetes, and my log collector can gather logs from stdout. Id like these logs to be in JSON, however I dont believe there is a way to have Kong log as JSON to stdout. My current solution is to create a really simple API which logs bodies to stdout, and have kong post all logs there using the HTTP log plugin. 

How can I have Kong write logs as JSON to stdout?

--
You received this message because you are subscribed to the Google Groups "Kong" group.
To unsubscribe from this group and stop receiving emails from it, send an email to konglayer+unsubscribe@googlegroups.com.
To post to this group, send email to kong...@googlegroups.com.
Visit this group at https://groups.google.com/group/konglayer.
To view this discussion on the web visit https://groups.google.com/d/msgid/konglayer/a41ef8c9-f727-4aa4-9fb8-d93070265340%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages