winston-elasticsearch
An ElasticSearch transport for Winston.
How to install
npm install --save winston https://github.com/malkomalko/winston-elasticsearch/tarball/master
How to use
More example(s) available in the examples directory.
var winston = require('winston');
var Elasticsearch = require('winston-elasticsearch');
var logger = new winston.Logger({
transports: [
new Elasticsearch({
level: 'info',
host: 'http://localhost:9200',
indexName: 'logs',
typeName: 'log',
requestTimeout: 30000
})
]
});
Options
level
[default='info'
] log levelfireAndForget
[default=false
] if set to true, it sends the data in back ground. If a callback is passed, it gets callback at the beginning of the function without parameters.indexName
[default='logs'
] Elasticsearch indextypeName
[default='log'
] Elasticsearch typeclient
An instance of elasticsearch client if given all the following options are ignored.host
Ignored ifclient
is set. See elasticsearch optionsrequestTimeout
[default=30000
] Ignored ifclient
is set.- Number of milliseconds to wait before aborting a request. Be sure to increase this if you do large bulk operations.
source
An identifier for the system/site/request that triggered the entry. Defaults to directory name of the main module filename of main module if not set.- Can be access within an overridden log function using
this.source
- Can be access within an overridden log function using
disable_fields
Disables the automatically generated and added fields that include PID, user, memory usage, runtime, etc.- Can be access within an overridden log function using
this.source
- Can be access within an overridden log function using