winston and loggly nothing shows up on loggly dashboard

会有一股神秘感。 提交于 2019-12-08 05:17:12

问题


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!'

What could be wrong?


回答1:


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!');


来源:https://stackoverflow.com/questions/19612060/winston-and-loggly-nothing-shows-up-on-loggly-dashboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!