Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
cannot add loggly transport to the newest winston #32
Comments
|
Fixed in |
|
Is it possible you are using the new keyword when instantiating the winston transport? If so, see the last troubleshooting step in our documentation https://www.loggly.com/docs/node-js-logs/. You might have to add "true" as the third parameter in your add function. |
|
for |
|
Okay thanks I think we need to have an engineer test this out |
|
Hi @piotr-s-brainhub, with JFYI, You are using winston's latest version i.e. cc: @mostlyjason |
|
I have the issue described in the original post. I upgraded winston to version 2.4.0 and my build broke. When I remove the Loggly transport my build succeeds. Not sure what the issue is but something between 2.3.1 and 2.4.0 changed that caused this library to stop working for me. |
|
Hi @dhaspden, I released a new beta package for winston-loggly-bulk library which internally install node-loggly-bulk. Can you please give a try with that beta package and let me know if the issue is resolved for you? If not, then please report me back with your complete stacktrace of the error you are getting. Use below command to install the new beta package:
I'll wait for your response. cc: @mchaudhary |
|
Hi @piotr-s-brainhub and @dhaspden, did you get some time to test the above beta package that I published some time before? I want to listen from you to see if the new release resolves your issue. Waiting for your reply. |
|
Hi @Shwetajain148 I'll carve some time out at lunch to give it a shot. Standby. |
|
I don't have enough time to check it. |
|
Okay sorry about the delay. I tried the beta version and got mixed results. Firstly I tried using the transport as normal... The first set of errors is using
When I do this I get the following error:
I was able to get it working by using the instance directly from the module...
Using
I hope that is detailed enough. I can provide more details if you need them. Thanks! |
|
Hi @dhaspden, Thanks for your input. Let's first talk about the first error that you mentioned with latest stable version
Please refer the Advanced Logging Section of the Loggly NodeJs document here- https://www.loggly.com/docs/node-js-logs/. Below is a sample code snippet to be more clear-
Note: For |
|
For some reason in node var winston = require('winston');
var {Loggly} = require('winston-loggly-bulk');
winston.add(new Loggly({
token: "[TOKEN]",
subdomain: "[SUBDOMAIN]",
tags: ["Winston-NodeJS"],
json: true
}));
winston.log('info', "Hello World from Node.js!");PS: Used version {
"winston": "^2.4.1",
"winston-loggly-bulk": "^2.0.2"
} |
|
Following works for us, we use typescript. import { Loggly } from 'winston-loggly-bulk';
winston.add(Loggly, { ...options }); |
|
Node: 10.4.1 when I try to run node server.js in terminal I’m getting this error /node_modules/winston-transport/legacy.js:18 Error: Invalid transport, must be an object with a log method. can any person help me to fix this issue? |
|
@sabry2010 Hello! I'm currently working on an official fix for this. I've got it 90%, just cleaning up some tests. It should be finished today or tomorrow. I'll keep you posted. |
|
@OtterCode okay thank you waiting you |
|
Hi @sabry2010, @OtterCode, Sorry for the delay in fix here, I was busy with some critical issues. JFYI, I am almost done with the initial support with Stay tuned. Thanks! |
|
Hi @piotr-s-brainhub, @dhaspden, @shahidcodes, @edorivai, @sabry2010, @OtterCode Good news here! Since See the usage here- https://github.com/loggly/winston-loggly-bulk/tree/3.x#usage You can setup the
Note: Please keep in mind that Do setup the library on new version and let me know your feedback/issues so that I can work on them. Please feel free to report bugs. PRs are always welcome. Thanks! |
|
@Shwetajain148 Did you end up using my PR? |
|
Cool thanks for sharing @Shwetajain148 can you test the new branch @OtterCode? Btw, @OtterCode is writing a blog on winston 3 support. |
|
@Shwetajain148 I follow all instructions and still I get issues loggly is a legacy winston transport. Consider upgrading:
|
|
Hi @sabry2010, Please correct your Loggly Customer Token. The library throws 403 Forbidden in case of wrong customer token used. You can find the customer token at- https://SUBDOMAIN.loggly.com/tokens Replace: SUBDOMAIN with your Loggly account subdomain. Hopefully, this will resolve your issue. |
|
Hi @OtterCode, I did not use your PR. In-fact, I just saw it now. Hi @mostlyjason, sorry it's a bit confusing. Are you asking me or @OtterCode to test the new branch? BTW, great to know that he's writing a blog. |
|
@Shwetajain148, @OtterCode is going to try to merge his changes from #39 into your branch. I'm then hoping you'll be able to test it. If you have more changes, can you add them tonight or hold until he's done so we don't create any merge conflicts? |
|
@OtterCode, Can you confirm when you are going to merge your changes into my branch? |
|
@Shwetajain148 The pull request has been up for a while. You can merge it if it looks good to you. |
|
He submitted #42 but I think he needs to fix some merge conflicts first |
|
Fixed the merge conflicts and added #43. @Shwetajain148 can you test? |
|
@mostlyjason @OtterCode, Yes, I'll test and will let you know how it goes. Thanks. |
|
I've been trying both @Shwetajain148 and @OtterCode and @mostlyjason's #43 with an empty project: $ mkdir scratch
$ cd scratch
$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help json` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
package name: (scratch)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to /Users/lars/Code/scratch/package.json:
{
"name": "scratch",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Is this OK? (yes)
$ npm install --save "mostlyjason/winston-loggly-bulk#ottercode"
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN scratch@1.0.0 No description
npm WARN scratch@1.0.0 No repository field.
+ winston-loggly-bulk@3.0.0-rc1
added 80 packages from 113 contributors and audited 119 packages in 5.777s
found 0 vulnerabilities
$ npm install --save winston
npm WARN scratch@1.0.0 No description
npm WARN scratch@1.0.0 No repository field.
+ winston@3.0.0
updated 1 package and audited 163 packages in 1.676s
found 0 vulnerabilities
$ micro scratch.js
$ node --version
v8.8.1
$ node scratch.js
loggly is a legacy winston transport. Consider upgrading:
- Upgrade docs: https://github.com/winstonjs/winston/blob/master/UPGRADE-3.0.md
After the initial debug message it just sits there for another 20 seconds. My var winston = require('winston');
var {Loggly} = require('winston-loggly-bulk');
const l = new Loggly({
token: "<secret>",
subdomain: "trieloff"
});
winston.add(l);
winston.log('info', "Hello World from Node.js!");So I'd say it does not work for me. Going through the test cases I could not find an example where the transport is called with winston (it's always tested standalone) and it looks like Winston assumes the implementation to be a legacy implementation. |
|
Hi @trieloff, I just replicated all the steps that you performed and I didn't see any problem my event logged to Loggly successfully. Did you search for your event in your Loggly account? I think you are getting confused with the termination of the command once the event has been logged because there is no other event to be logged. This is default library behavior to not let any open handler keep on running. Also, I noticed that you ran the command to install the If you setup your
The above code will log 5 events in each 5 seconds. In anyway, if you log a single event, it will be logged to Loggly without any issue. Please let me know if you see any error/issue. Thanks. |
|
@Shwetajain148 It's a legacy transport because the Loggly.log function accepts too many arguments. There's an undocumented update in Winston 3.x that requires the log function to be written with only two arguments: info, and callback. For the current winston-loggly-bulk, this means that there's a huge amount of code that needs cutting, since Winston now takes responsibility for it. It still works in legacy mode for the moment, but it's something that needs doing sooner or later. |
|
Node: 8.6.0
npm: 5.2.0
OS: Mac OS X 10.12.6
winston: 3.0.0-rc1
winston-loggly-bulk: 2.0.2
I'm trying to use
winston-loggly-bulkas in theREADME.mdand it doesn't work.I obtain:
The text was updated successfully, but these errors were encountered: