diff --git a/README.md b/README.md index 8c1ba40b3..702a989cd 100644 --- a/README.md +++ b/README.md @@ -625,6 +625,7 @@ The File transport should really be the 'Stream' transport since it will accept * __maxFiles:__ Limit the number of files created when the size of the logfile is exceeded. * __stream:__ The WriteableStream to write output to. * __json:__ If true, messages will be logged as JSON (default true). +* __logstash:__ If true, messages will be logged using the logstash JSON format. *Metadata:* Logged via util.inspect(meta); diff --git a/lib/winston/transports/file.js b/lib/winston/transports/file.js index 96a38ca9f..40e5ecd9f 100644 --- a/lib/winston/transports/file.js +++ b/lib/winston/transports/file.js @@ -72,6 +72,7 @@ var File = exports.File = function (options) { this.prettyPrint = options.prettyPrint || false; this.label = options.label || null; this.timestamp = options.timestamp != null ? options.timestamp : true; + this.logstash = options.logstash || false; if (this.json) { this.stringify = options.stringify; @@ -126,7 +127,8 @@ File.prototype.log = function (level, msg, meta, callback) { prettyPrint: this.prettyPrint, timestamp: this.timestamp, stringify: this.stringify, - label: this.label + label: this.label, + logstash: this.logstash }) + '\n'; this._size += output.length;