Skip to content

Commit

Permalink
Merge branch 'master' of github.com:simianhacker/bunyan-elasticsearch
Browse files Browse the repository at this point in the history
  • Loading branch information
Thales Pinheiro committed Mar 28, 2016
2 parents 01262e7 + 2aadf82 commit 9518e7e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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];
Expand Down

0 comments on commit 9518e7e

Please sign in to comment.