fastify-fluentd
v0.2.8
Published
Fluent plugin for fastify framework
Downloads
14
Maintainers
Readme
fastify-fluentd
Fastify plugin for fluentd. Under the hood the official fluent/fluent-logger-node module is used.
What is Fluentd?
Fluentd is an open source data collector for unified logging layer. Fluentd allows you to unify data collection and consumption for a better use and understanding of data.
Install
npm i fastify-fluentd --save
Usage
Add it to your project with register and you are done!
const fastify = require('fastify')()
fastify.register(require('fastify-fluentd'), {
prefix: 'debug',
config: {
host: 'localhost',
port: 24224,
timeout: 3.0,
reconnectInterval: 600000
}
})
fastify.get('/user/:id', function (req, reply) {
this.fluentd.emit('user', { request: req.params.id })
})
fastify.listen(3000, err => {
if (err) throw err
})
License
Licensed under MIT.