loggly vs winston-loggly-bulk vs loggly-jslogger
Logging Libraries for Node.js Comparison
1 Year
logglywinston-loggly-bulkloggly-jsloggerSimilar Packages:
What's Logging Libraries for Node.js?

These libraries are designed to facilitate logging in Node.js applications, specifically integrating with Loggly, a cloud-based log management service. They help developers capture and send logs from their applications to Loggly for analysis, monitoring, and troubleshooting. Each library has its own unique features and use cases, making them suitable for different logging needs and scenarios.

Package Weekly Downloads Trend
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
loggly60,861233-229 years agoMIT
winston-loggly-bulk27,0793722.6 kB96 months agoMIT
loggly-jslogger20,8887943.6 kB17-MIT
Feature Comparison: loggly vs winston-loggly-bulk vs loggly-jslogger

Integration

  • loggly:

    Loggly provides a simple API for sending logs directly to its service, making it easy to set up and use without additional configurations. It is suitable for basic logging needs where direct integration is sufficient.

  • winston-loggly-bulk:

    This package integrates with the popular Winston logging library, allowing you to use Winston's features such as log levels, transports, and formats while sending logs to Loggly in an efficient bulk manner.

  • loggly-jslogger:

    This library is tailored for client-side applications, allowing you to send logs from the browser to Loggly. It handles cross-origin requests and is optimized for use in web environments, making it ideal for front-end logging.

Use Case

  • loggly:

    Best suited for server-side applications where you need to log events, errors, and other information directly to Loggly without the need for complex setups or additional libraries.

  • winston-loggly-bulk:

    Perfect for applications with high logging volumes, as it batches log messages and sends them to Loggly in bulk. This reduces the number of requests made to the Loggly service, improving performance and reducing costs.

  • loggly-jslogger:

    Ideal for front-end applications where capturing user interactions, errors, and performance metrics is essential. It allows developers to monitor client-side behavior and troubleshoot issues effectively.

Performance

  • loggly:

    Offers good performance for basic logging needs, but may not be optimized for high-frequency logging scenarios where log volume is significant.

  • winston-loggly-bulk:

    Optimized for performance in high-volume logging scenarios, this package reduces the number of API calls by batching logs, which can significantly enhance the efficiency of log transmission.

  • loggly-jslogger:

    Designed for client-side performance, it minimizes the impact of logging on user experience by efficiently managing log requests from the browser.

Configuration

  • loggly:

    Requires minimal configuration to get started, making it user-friendly for developers who want to quickly implement logging without extensive setup.

  • winston-loggly-bulk:

    Offers extensive configuration options through Winston, allowing developers to define custom log formats, levels, and transports, providing flexibility for complex logging requirements.

  • loggly-jslogger:

    Provides configuration options tailored for browser environments, allowing developers to customize log levels and formats specific to client-side needs.

Community and Support

  • loggly:

    As a standalone library, it has a smaller community compared to more extensive frameworks, but it benefits from Loggly's support and documentation.

  • winston-loggly-bulk:

    Benefits from the large Winston community, providing extensive resources, plugins, and support for developers using Winston for logging.

  • loggly-jslogger:

    Has a niche community focused on client-side logging, with resources available for troubleshooting and integration with web applications.

How to Choose: loggly vs winston-loggly-bulk vs loggly-jslogger
  • loggly:

    Choose Loggly if you need a straightforward logging solution that directly integrates with the Loggly service. It is suitable for applications where you want to send logs without additional dependencies or complex configurations.

  • winston-loggly-bulk:

    Select winston-loggly-bulk if you are already using Winston for logging in your Node.js application. This package provides a seamless integration with Winston, allowing you to leverage its features while sending logs to Loggly in bulk, which can be more efficient for high-volume logging.

  • loggly-jslogger:

    Opt for loggly-jslogger if you are working on a front-end application or a client-side JavaScript project. This library is specifically designed for logging in browser environments, making it ideal for capturing client-side logs and sending them to Loggly.

README for loggly

node-loggly

Version npmnpm DownloadsBuild StatusDependencies

NPM

A client implementation for Loggly in node.js. Check out Loggly's Node logging documentation for more.

Usage

The node-loggly library is compliant with the Loggly API. Using node-loggly is easy for a variety of scenarios: logging, working with devices and inputs, searching, and facet searching.

Getting Started

Before we can do anything with Loggly, we have to create a client with valid credentials. We will authenticate for you automatically:

  var loggly = require('loggly');

  var client = loggly.createClient({
    token: "your-really-long-input-token",
    subdomain: "your-subdomain",
    auth: {
      username: "your-username",
      password: "your-password"
    },
    //
    // Optional: Tag to send with EVERY log message
    //
    tags: ['global-tag']
  });

Logging

There are two ways to send log information to Loggly via node-loggly. The first is to simply call client.log with an appropriate input token:

  client.log('127.0.0.1 - Theres no place like home', function (err, result) {
    // Do something once you've logged
  });

Note that the callback in the above example is optional, if you prefer the 'fire and forget' method of logging:

  client.log('127.0.0.1 - Theres no place like home');

Logging with Tags

If you're using Loggly's tags functionality, simply include an array of tags as the second argument to the log method:

  client.log('127.0.0.1 - Theres no place like home', [ 'dorothy' ], function (err, result) {
    // Do something once you've logged
  });

note Tags passed into the log function will be merged with any global tags you may have defined.

Logging Shallow JSON Objects as a String

In addition to logging pure strings it is also possible to pass shallow JSON object literals (i.e. no nested objects) to client.log(..) or input.log(..) methods, which will get converted into the Loggly recommended string representation. So

  var source = {
    foo: 1,
    bar: 2,
    buzz: 3
  };

  input.log(source);

will be logged as:

  foo=1,bar=2,buzz=3

Logging JSON Objects

It is also possible to log complex objects using the new JSON capabilities of Loggly. To enable JSON functionality in the client simply add 'json: true' to the configuration:

  var config = {
    subdomain: "your-subdomain",
    auth: {
      username: "your-username",
      password: "your-password"
    },
    json: true
  };

When the json flag is enabled, objects will be converted to JSON using JSON.stringify before being transmitted to Loggly. So

  var source = {
    foo: 1,
    bar: 2,
    buzz: {
      sheep: 'jumped',
      times: 10
    }
  };

  input.log(source);

will be logged as:

  { "foo": 1, "bar": 2, "buzz": {"sheep": "jumped", "times": 10 }}

Logging arrays

It is possible to send arrays, which will result in one single request to Loggly.

  input.log([ {iam:'number 1'}, {iam:'number 2'} ])

Searching

Searching with node-loggly is easy. All you have to do is use the search() method defined on each Loggly client:

  var util = require('util');

  client.search('404', function (err, results) {
    // Inspect the result set
    console.dir(results.events);
  });

The search() method can also take an Object parameter that allows you to set additional search parameters such as: rows, from, until, etc.

  var util = require('util');

  client.search({ query: '404', rows: 10 })
    .run(function (err, results) {
      // Inspect the result set
      console.dir(results.events);
    });

See the Loggly search guide for more details on how to effectively search through your Loggly logs.

Installation

Installing npm (node package manager)

  $ curl http://npmjs.org/install.sh | sh

Installing node-loggly

  $ npm install loggly

Run Tests

All of the node-loggly tests are written in vows, and cover all of the use cases described above. You will need to add your Loggly username, password, subdomain, and a two test inputs to test/data/test-config.json before running tests. When configuring the test inputs on Loggly, the first test input should be named 'test' using the HTTP service. The second input should be name 'test_json' using the HTTP service with the JSON logging option enabled:

  {
    "token": "your-really-long-token-you-got-when-you-created-an-http-input",
    "subdomain": "your-subdomain",
    "auth": {
      "username": "your-username",
      "password": "your-password"
    }
  }

Once you have valid Loggly credentials you can run tests with vows:

  $ npm test

Author: Charlie Robbins

Contributors: Marak Squires, hij1nx, Kord Campbell, Erik Hedenström,