Skip to content
A graylog2 transport for winston
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


A graylog2 transport for winston


npm install winston-graylog2


A convenience wrapper may be supported in the future but for now the easiest way to use is to instantiate a new winston logger and add winston-graylog2 as a transport.

var winston = require("winston"),
graylog2 = require("winston-graylog2").Graylog2,
levels = winston.config.syslog.levels;

// Initialize logger
var logger = new (winston.Logger)({
  levels: levels,
  transports: [new (graylog2)()]

// Log something
logger.log('emerg', 'FIX THIS NOW');
logger.emerg('NO RLY');

The default winston logger settings should not be used because Graylog2 expects the log levels to be syslog levels. All else should function the same as other loggers.

Meta data

By default, the pid and cwd are added to the graylog meta fields. All other meta fields passed to winston get sent along in the meta data as well.

Transport options

  1. host [value]: 'localhost'
  2. port [value]: 12201
  3. level [value]: 'info'
  4. facility [value]: 'winston-graylog2'
  5. timestamp [value or function]: function() { ((new Date()).getTime()/1000).toFixed(2); }; (current time in seconds)


  1. Add chunking to messages
  2. More pleasant way to flatten meta fields without changing logger api


  1. winston
  2. node-graylog
  3. winston-riak
  4. gelf spec
  5. graylog2


There is another winston-graylog2 module,, that was made independently. I opted to keep this repo separate for a few reasons, one of them being that only a subset of the syslog logging levels are exposed in the other project.

Something went wrong with that request. Please try again.