logging温斯顿 – 蒙戈德,特快 – 温斯顿和温斯顿

我使用winston,expressWinston,winston-mongoDB来pipe理我的NodeJs应用程序中的日志。

用express-winston使用winston-mongodb传输; 我可以将日志以下面的格式存储到我的mongoDB集合中。 (元:真)

{ "_id" : ObjectId("5a124f9781d911337ebeb98d"), "timestamp" : ISODate("2017-11-20T03:44:23.336Z"), "level" : "info", "message" : "GET /stylesheets/bootstrap.css 304 2ms", "meta" : { "res" : { "statusCode" : 304 }, "req" : { "url" : "/stylesheets/bootstrap.css", "headers" : { "host" : "localhost:3000", "connection" : "keep-alive", }, "method" : "GET", "httpVersion" : "1.1", "originalUrl" : "/stylesheets/bootstrap.css", "query" : {} }, "responseTime" : 2 } 

我可以在元中获取请求/响应信息。

这些细节可能直接成为collections的一部分吗? ,像这样的东西:

 { "_id" : ObjectId("5a12537d81b6b634cb7d4696"), "timestamp" : ISODate("2017-11-20T04:01:01.229Z"), "level" : "info", "message" : "GET /stylesheets/bootstrap.css 304 11ms", "status": 200, "requestUrl": '/', "requestMethod": 'GET', "remoteIp": '::1' "meta" : {} 

}