From c9ebc5e2c5a508bacaf1118f751b0eea2b5a47ba Mon Sep 17 00:00:00 2001 From: Thales Pinheiro Date: Mon, 28 Mar 2016 11:18:36 -0700 Subject: [PATCH] Issue #8 --- index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index d615ae0..8a3d752 100644 --- a/index.js +++ b/index.js @@ -29,7 +29,7 @@ function ElasticsearchStream (options) { this._client = options.client || new elasticsearch.Client(options); this._type = options.type || 'logs'; var indexPattern = options.indexPattern || '[logstash-]YYYY.MM.DD'; - this._index = options.index || generateIndexName.bind(null, indexPattern); + this._index = options.index || generateIndexName.bind(null, indexPattern); Writable.call(this, options); } @@ -42,14 +42,13 @@ ElasticsearchStream.prototype._write = function (entry, encoding, callback) { var type = this._type; var d = domain.create(); - d.on('error', function (err) { + d.on('error', function (err) { console.log("Elasticsearch Error", err.stack); }); d.run(function () { entry = JSON.parse(entry.toString('utf8')); - var env = process.env.NODE_ENV || 'development'; - // Reassign these fields so them match what the default Kibana dashboard + // Reassign these fields so them match what the default Kibana dashboard // expects to see. entry['@timestamp'] = entry.time; entry.level = levels[entry.level];