@@ -8,11 +8,8 @@ A [Loggly][0] transport for [winston][1].
A client implementation for Loggly in node.js. Check out Loggly's [Node logging documentation](https://www.loggly.com/docs/nodejs-logs/) for more.
##Looking for `winston-loggly-bulk@3.x` documentation?
Please note that the documentation below is for `winston-loggly-bulk@2.x`. [Read the winston-loggly-bulk@3.x documentation](https://github.com/loggly/winston-loggly-bulk/tree/3.x).
##Usage
``` js
var winston =require('winston');
@@ -25,13 +22,11 @@ Please note that the documentation below is for `winston-loggly-bulk@2.x`. [Read
winston.add(newLoggly({options}));
```
The Loggly transport is based on [Nodejitsu's][2] [node-loggly][3] implementation of the [Loggly][0] API. If you haven't heard of Loggly before, you should probably read their [value proposition][4]. The Loggly transport takes the following options. Either 'inputToken' or 'inputName' is required:
The Loggly transport is based on [Nodejitsu's][2] [node-loggly][3] implementation of the [Loggly][0] API. If you haven't heard of Loggly before, you should probably read their [value proposition][4]. The Loggly transport takes the following options.
*__level:__ Level of messages that this transport should log.
*__subdomain:__ The subdomain of your Loggly account. *[required]*
*__auth__: The authentication information for your Loggly account. *[required with inputName]*
*__inputName:__ The name of the input this instance should log to.
*__inputToken:__ The input token of the input this instance should log to.
*__token:__ The access token (previously inputToken) *[required]*
*__auth__: The authentication information for your Loggly account.
This conversation was marked as resolved
by michal-bures
Again the package uses node-loggly-bulk and there are both token and auth. Token is required, auth seems to be useless, but still I wasn't sure whether it's save to remove it completely.
*__json:__ If true, messages will be sent to Loggly as JSON.
*__tags:__ An array of tags to send to loggly.
*__isBulk:__ If true, sends messages using bulk url
@@ -43,13 +38,11 @@ The Loggly transport is based on [Nodejitsu's][2] [node-loggly][3] implementatio
-__Note:__ Library includes timestamp by default when we do not set timestamp option.
*__networkErrorsOnConsole:__ The library keep track of different network errors and can log them to console. By default, logging errors on console is disabled and can be enabled easily by setting this parameter's value to `true`. If true, all the network errors will be logged to console.
*Metadata:* Logged in suggested [Loggly format][5]
##Sample Working Code Snippet
``` js
var winston =require('winston');
var {Loggly} =require('winston-loggly-bulk');
var {Loggly} =require('winston-loggly-bulk');
winston.add(newLoggly({
token:"TOKEN",
@@ -66,12 +59,14 @@ winston.log('info', "Hello World from Node.js!");
This library has buffer support during temporary network outage. User can configure size of buffer (no. of logs to be stored during network outage).
Add these below configuration in code snippet to override the default values of buffer option __size__ and __retriesInMilliSeconds__.
``` js
bufferOptions: {
size:1000,
retriesInMilliSeconds:60*1000
size:1000,
retriesInMilliSeconds:60*1000
}
```
*__Note:__ The default value of buffer size and retries in milliseconds are 500 and 30000 (30 seconds) respectively.
##Flush logs and exit
@@ -82,54 +77,40 @@ Here is an example of how to use the method:
``` js
var winston =require('winston');
var {flushLogsAndExit} =require('winston-loggly-bulk');
var {flushLogsAndExit} =require('winston-loggly-bulk');
winston.log("info", "Hello World from Node.js!");
flushLogsAndExit();
```
##Motivation
`tldr;?`: To break the [winston][1] codebase into small modules that work together.
The [winston][1] codebase has been growing significantly with contributions and other logging transports. This is **awesome**. However, taking a ton of additional dependencies just to do something simple like logging to the Console and a File is overkill.
##Installation
###Installing npm (node package manager)
``` bash
$ curl http://npmjs.org/install.sh | sh
```
###Installing winston-loggly-bulk
If you are running npm version 3 or higher then run the below command to setup the logging-
``` bash
$ npm install winston-loggly-bulk
npm install winston-loggly-bulk
```
If you are running npm version 2 or lower then run the below command to setup the logging-
``` bash
$ npm install winston-loggly-bulk winston
```
*__Note:__ To check the currrent npm version run the below command-
Note: If you are using npm version 2, please run the below command:
``` bash
$ npm -v
npm install winston-loggly-bulk winston
```
##Run Tests
All of the winston tests are written in [vows][6], and cover all of the use cases described above. You will need to add valid credentials for the various transports included to test/config.json before running tests:
All of the winston tests are written in [vows][5], and cover all of the use cases described above. You will need to add valid credentials for the various transports included to `test/config.json` before running tests:
This part appears to be pointless? It's not used by the tests. Maybe someone planned to login to loggly API and verify the logs arrived as part of the tests... but there's no such thing implemented. Let's remove it from here and from the sample config.
Yes, pointless. Anyway, the package uses node-loggly-bulk and there is auth used, so I decided not to remove it. If it's useless node-loggly-bulk should be reviewed as well.
"username":"your-username",
"password":"your-password"
@@ -139,20 +120,20 @@ All of the winston tests are written in [vows][6], and cover all of the use case
}
```
Once you have valid configuration and credentials you can run tests with [npm][7]:
Once you have valid configuration and credentials you can run tests with [npm][6]:
ProTip!
Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products.
Learn more.
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products.
You can always update your selection by clicking Cookie Preferences at the bottom of the page.
For more information, see our Privacy Statement.
Essential cookies
We use essential cookies to perform essential website functions, e.g. they're used to log you in.
Learn more
Always active
Analytics cookies
We use analytics cookies to understand how you use our websites so we can make them better, e.g. they're used to gather information about the pages you visit and how many clicks you need to accomplish a task.
Learn more
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LOG-8039 update packages #59
LOG-8039 update packages #59
Changes from 1 commit
7a6d534cba56c6cc57ab62bd43603a169978df87fe3d9ca73efb5a4995225d9583e02e644466d65d427032d20ecbc2a7baa46d63c7f45e1b6653450cc945faFile filter...
Jump to…
LOG-8039 update packages
michal-buresMar 26, 2020
•
edited
This is normally not needed right? Actually is basic auth supported at all anymore? I recommend testing it and if it doesn't work remove this.
Especially since "token" is required, there seems to be no point in entering username/password
alestrundaMar 26, 2020
Author
Again the package uses node-loggly-bulk and there are both token and auth. Token is required, auth seems to be useless, but still I wasn't sure whether it's save to remove it completely.
michal-buresMar 26, 2020
This part appears to be pointless? It's not used by the tests. Maybe someone planned to login to loggly API and verify the logs arrived as part of the tests... but there's no such thing implemented. Let's remove it from here and from the sample config.
alestrundaMar 26, 2020
Author
Yes, pointless. Anyway, the package uses node-loggly-bulk and there is auth used, so I decided not to remove it. If it's useless node-loggly-bulk should be reviewed as well.