1.0.3 • Published 9 years ago
winston-loggly-transport v1.0.3
LogglyTransport
A Loggly transport for winston, with support for bulk log posts.
Usage
LogglyTransport may be installed via npm:
npm install --save winston-loggly-transportYou can register LogglyTransport like any other winston transport:
const winston = require('winston');
const LogglyTransport = require('winston-loggly-transport');
// using the default logger
winston.add(LogglyTransport, {
  token: 'yourLogglyToken',
  subdomain: 'your-loggly-subdomain'
});
// or, with a new logger instance:
const logger = new winston.Logger({
  transports: [
    new LogglyTransport({
      token: 'yourLogglyToken',
      subdomain: 'your-loggly-subdomain'
    });
  ]
});
// Log like normal:
logger.info('A message to send to Loggly', { 
  some: { meta: 'data' }
});Options
The following options are available for LogglyTransport:
// All options are optional, unless otherwise marked
new LogglyTransport({
  // Your Loggly API token (required)
  token: 'yourLogglyToken',
  // Your Loggly subdomain (required)
  subdomain: 'your-loggly-subdomain',
  // Tags to apply to all logs
  tags: [],
  // Messages logged within this time period (ms) 
  // will be sent together in bulk
  bufferInterval: 1000,
  // If there are this many messages
  // in the buffer, they will be sent together in bulk
  // (even if bufferInterval is not yet complete)
  bufferSize: 100,
  // If set to true, no messages will be sent to Loggly
  silent: false,
  // Minimum level at which messages 
  // will be sent to Loggly
  level: null
});Comparison to winston-loggly
This library was built as an alternative to winston-loggly, to overcome a few issues in that library:
winston-logglydoes not support bulk requestswinston-logglyis missing test coverage of basic behavior, making new development by an outside developer tricky.
On the other hand, this library is missing some behavior provided by winston-loggly:
winston-loggly-transportdoes not yet support non-bulk requestswinston-loggly-transportdoes not yet support tags on individual logs (because in bulk requests, only one set of tags may be specified for all logs)winston-loggly-transportdoes not yet support HTTP authorizationwinston-loggly-transportdoes not yet accept unique input nameswinston-loggly-transportdoes not yet support thewinstonstreaming api.winston-loggly-transportdoes not yet support thewinstonquery api.