express-fluent-logger
v0.3.3
Published
access logger middleware using fluentd for express.js
Downloads
322
Readme
express-fluent-logger
access logger middleware using fluentd for express.js
Install
$ npm install express-fluent-logger
Example
var app = require('express')();
var logger = require('express-fluent-logger');
app.use(logger());
app.get('/', function(req, res) {
res.send('hello world!');
});
app.listen(3000);
Parameters
- tag: String of tag name on fluentd. (default:
debug
) - options: Object of fluentd connection. (default:
{ host: '127.0.0.1', port: 24224, timeout: 3.0 }
)
Logging HTTP response headers
This middleware will record the http response header, if you specify options.responseHeaders
as following.
var app = require('express')();
var logger = require('express-fluent-logger');
app.use(logger('tagName', { host: '127.0.0.1', port: 24224, timeout: 3.0, responseHeaders: ['x-userid'] }));
app.get('/', function(req, res) {
res.send('hello world!');
});
app.listen(3000);
Test
$ fluentd -c test/fluent.conf &
$ npm test
License
About NodeJS version
This package is compatible with NodeJS versions >= 6.