console.log 来自 node.js 的应用程序未在 sumoLogic 中拆分为多个日志

console.log from node.js application not splitting in multiple logs in sumoLogic

我正在使用 node.js 进行内部应用。 docker 此 node.js 应用程序的映像已部署。 部署后,我在 SumoLogic 中看到了所有 console.log,但所有日志都是一条大消息。这使得在生产中调试真的很困难。有没有办法在 SumoLogic 中将我的日志分成单独的消息?

参见the docs for "Multiline Processing"。 基本上,您可以配置 Sumo Logic 如何将大消息拆分为多条消息。检查您是否开启了此功能:

  • “推断边界”:

This option will apply a set of default expressions, which are used to detect the beginning of a new multi-line message. When a message line matches one of these expressions, Sumo Logic waits until the next instance of this same expression, and then groups all lines between them as a single message.

还有“边界正则表达式”,您可以在其中指定一个正则表达式来确定将什么视为两条日志消息之间的边界。请注意,它并不总是换行符,因为在某些 languages/frameworks 中,您经常将一些结构化数据作为一个“日志”。老实说,我不确定这里的nodejs标准是什么。

免责声明:我目前受雇于 Sumo Logic。