Elasticsearch Logger for Node.js
A configuration-free Elasticsearch logger for node.js with sane defaults.
Usage
Check out the example here.
const logger = ; try throw 'An error has occurred.'; catch e logger ;
Options
elasticsearch-logger
accepts an optional options
parameter during creation.
Example
const createLogger = ; const logger =
Param | Type | Default | Description |
---|---|---|---|
hosts |
array or string |
localhost:9200 |
The names of elasticsearch hosts. |
host |
string |
localhost:9200 |
The name of the elasticsearch host. |
application |
string |
process.env.npm_package_name |
application name added to log payload. |
environment |
string |
process.env.NODE_ENV or local |
environment name added to log payload. |
index |
string |
logger |
Elasticsearch index name for logger. |
Requirements
- Node.js 6+
- Elasticsearch