https://github.com/ramonpaolo/winston-elastic
Winston transport to save logs in Elasticsearch
https://github.com/ramonpaolo/winston-elastic
elasticsearch good-first-issue logging nodejs open-source opensource winston
Last synced: about 2 months ago
JSON representation
Winston transport to save logs in Elasticsearch
- Host: GitHub
- URL: https://github.com/ramonpaolo/winston-elastic
- Owner: ramonpaolo
- License: mit
- Created: 2023-09-07T20:06:05.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-26T12:09:39.000Z (over 2 years ago)
- Last Synced: 2024-10-05T11:23:16.951Z (over 1 year ago)
- Topics: elasticsearch, good-first-issue, logging, nodejs, open-source, opensource, winston
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/elasticsearch-transport
- Size: 17.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# elasticsearch-transport
A ElasticSearch transport for [winston][0].
## Motivation
A small library to enable send logs to elasticsearch to analyze logs and build dashboards in Grafana, Kibana or customized plataform.
## Usage
```js
import winston from 'winston'
import TransportElastic from 'elasticsearch-transport'
const logger = winston.createLogger({
format: winston.format.combine(winston.format.timestamp(), winston.format.json(), winston.format.prettyPrint()),
transports: [
new winston.transports.Console()
new TransportElastic({
silent: false,
elasticClient: {
node: 'http://elasticsearch:9200',
auth: {
username: 'elastic',
password: 'elastic',
}
}
})
],
});
logger.info('saving log in elasticsearch!!');
```
The Elastic transport takes the following options. All options is required:
| Option | Description |
| ------ | :----------------------------------------------- |
| silent | **REQUIRED**. Enable or disable to save the log in elasticsearch |
| elasticClient | **REQUIRED**. The options/credentials to connect in ElasticSearch |
## Installation
**NPM**
```bash
$ npm install winston elasticsearch-transport
```
**Yarn**
```bash
$ yarn add winston elasticsearch-transport
```
### Made by Ramon Paolo Maram ❤
[0]: https://github.com/winstonjs/winston