Best practice to set the kong log_level in production environment?
We use notice. I guess it depends on how much detail you prefer .
Thanks. what are the log level severity will create the problem in API transaction?
Review the options here: http://nginx.org/en/docs/ngx_core_module.html#error_log
“Can be one of the following:
alert , or
emerg . Log levels above are listed in the order of increasing severity. Setting a certain log level will cause all messages of the specified and more severe log levels to be logged. For example, the default level
error will cause
alert , and
emerg messages to be logged. If this parameter is omitted then
error is used.”
I have never seen a crit/alert/emerg thrown before, maybe I am just lucky though . I prefer more logs rather than less though(but debug mode is just flood of logs so maybe not go that low). My suggestion is try a few and see what works before your your use case. Maybe starting at notice and work your way up to higher error alert thresholds if its too “chatty” .
Thanks for sharing your experience @jeremyjpj0916. As an additional recommendation, I would also strongly suggest not setting the log level higher than
error, possibly even
A few notes on how Kong uses those logging levels:
debug: debugging info about the plugins runloop and each individual plugin or other components. Very chatty like Jeremy said, but useful when debugging, e.g. is plugin xyz running?
notice: informational log about normal behavior, can mostly be ignored. Kong does not make a big difference between both of these levels (although syslog(2) does).
warn: abnormal behavior, not resulting in dropped transactions, but should be investigated.
error: an error that resulted in a request being dropped. The client probably received an HTTP 500 response or similar. Monitoring the rate of these logs is important, as they can happen occasionally, but an abnormally high rate of error logs can mean that something is wrong and a large number of clients are suffering from it.
crit: Kong is operating in critical conditions; it most likely isn’t working properly and a large number of clients are suffering from it. This log level warrants waking somebody up from your team.
Kong does not make use of
emerg, although we are thinking of moving some
crit messages to
alert, to better reflect log messages upon which action must be immediately taken).
To conclude, using
log_level = notice is the default, recommended setting. If too chatty, bump it to
warn, but ideally not higher