Winston和Loggly在Loggly仪表板上什么都没有显示 [英] winston and loggly nothing shows up on loggly dashboard
本文介绍了Winston和Loggly在Loggly仪表板上什么都没有显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
试图用Winston进行Loggly设置,但没有任何显示!我尝试了一个包罗万象的源组:
Trying to set up loggly with winston, and nothing shows up! I tried a catch-all source group:
并尝试了一个简单的信息日志:
And tried a simple info log:
winston = require 'winston'
Loggly = require('winston-loggly').Loggly
winston.add Loggly, {
subdomain: "my-subdomain",
inputToken: "my-input-token-ihawof9ahw3fo9ahwe",
json: true
}
winston.info 'Hello Loggly!'
有什么问题吗?
推荐答案
Loggly发布了新版本-Gen2. Gen2尚未在Winston-loggly软件包中实现.与Loggly团队沟通后,我发现了一个基于此问题评论的解决方案:
Loggly released new version - Gen2. Gen2 is not implemented in winston-loggly package yet. After my communication with Loggly Team I found out a solution based on this issue comment:
var winston = require('winston');
require('winston-loggly');
var logger = new (winston.Logger)({
transports: [
//new (winston.transports.Console)(),
new (winston.transports.Loggly)({
inputToken: 'mytoken',
subdomain: 'mydomain',
auth: { username: 'myusername', password: 'pswd' },
json: true
})
]
});
Object.defineProperty(logger.transports.loggly.client.config, 'inputUrl', {
value: 'https://logs-01.loggly.com/inputs/',
enumerable: true,
configurable: true
});
logger.info('Hello Loggly!');
这篇关于Winston和Loggly在Loggly仪表板上什么都没有显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文