Production Kong Log level

Best practice to set the kong log_level in production environment?

We use notice. I guess it depends on how much detail you prefer :slight_smile: .

Thanks. what are the log level severity will create the problem in API transaction?

Review the options here:

“Can be one of the following: debug , info , notice , warn , error , crit , 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 error , crit , 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 :slight_smile: . 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 warn.

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?
  • info/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 alert and 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 :slight_smile:

1 Like

Thanks @jeremyjpj0916 and @thibaultcha.

we are getting following error in error.log file with exactly 2hr interval.

“2018/09/26 13:29:26 [error] 5247#0: send() failed (111: Connection refused)”

The above error will affect the API transaction? yes means how to fix the issues?