A client implementation for Loggly cloud Logging-as-a-Service API
Last updated 2 years ago by loggly-hoover .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install node-loggly-bulk 
SYNC missed versions from official npm registry.


Version npmnpm Downloads


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


The node-loggly-bulk library is compliant with the Loggly API. Using node-loggly-bulk 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('node-loggly-bulk');

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


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

  client.log(' - 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(' - 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(' - 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


will be logged as:


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


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 with node-loggly-bulk is easy. All you have to do is use the search() method defined on each Loggly client:

  var util = require('util');'404', function (err, results) {
    // Inspect the result set

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');{ query: '404', rows: 10 })
    .run(function (err, results) {
      // Inspect the result set

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


Installing npm (node package manager)

  $ curl | sh

Installing node-loggly-bulk

  $ npm install node-loggly-bulk

Run Tests

Run Tests by sending events to your Loggly Account

All of the node-loggly-bulk 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 your loggly token to test/config.json before running tests.

    "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

Run Tests with Mock HTTP Request

To mock the HTTP requests and run test cases in your local machine you can run the following command

  $ npm run test-as-mock

Author: Charlie Robbins

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

Current Tags

  • 2.2.4-beta                                ...           beta (2 years ago)
  • 2.2.4                                ...           latest (2 years ago)
  • 2.2.1-beta                                ...           next (3 years ago)

20 Versions

  • 2.2.4                                ...           2 years ago
  • 2.2.4-beta                                ...           2 years ago
  • 2.2.3                                ...           2 years ago
  • 2.2.3-beta                                ...           2 years ago
  • 2.2.2                                ...           3 years ago
  • 2.2.2-beta                                ...           3 years ago
  • 2.2.1                                ...           3 years ago
  • 2.2.1-beta                                ...           3 years ago
  • 2.2.0                                ...           3 years ago
  • 2.1.0 [deprecated]           ...           3 years ago
  • 2.0.3                                ...           3 years ago
  • 2.0.2                                ...           3 years ago
  • 2.0.1                                ...           3 years ago
  • 2.0.0                                ...           3 years ago
  • 1.2.1                                ...           4 years ago
  • 1.2.0                                ...           4 years ago
  • 1.1.3                                ...           4 years ago
  • 1.1.2                                ...           4 years ago
  • 1.1.1                                ...           4 years ago
  • 1.1.0                                ...           4 years ago

Copyright 2014 - 2016 © |