/winston-elasticsearch

An Elasticsearch transport for winston

Primary LanguageJavaScriptMIT LicenseMIT

winston-elasticsearch

An ElasticSearch transport for Winston.

How to install

npm install --save winston winston-elasticsearch

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' })
  ]
});

Options

  • level ['info'] log level
  • fireAndForget [false] if set to true, it sends the data in back ground. If a callback is passed, it gets callback at the begining of the function without parameters.
  • indexName ['logs'] Elasticsearch index
  • typeName ['log'] Elasticsearch type
  • client An instance of elastical client if given all the following options are ignored.
  • host Ignored if client is set. See elastical options
  • port Ignored if client is set. See elastical options
  • auth Ignored if client is set. See elastical options
  • protocol Ignored if client is set. See elastical options
  • curlDebug Ignored if client is set. See elastical options
  • basePath Ignored if client is set. See elastical options
  • timeout Ignored if client is set. See elastical options
  • 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.
  • disable_fields Disables the automatically generated and added fields that include PID, user, memory usage, runtime, etc.