I am running a node.js express app in AWS behind an Elastic Load Balancer. I am using 'morgan' as my logging mechanism.
ELB sends a keep-alive request periodically, the target of which I have defined as a 1 char text file (keep-alive.txt).
Obviously, I don't want to see these requests in the log, so I have used the morgan skip function as follows:
// use morgan to log requests to the console
var morganOptions = {
skip: function (req, res) {
return req.get('/keep-alive.txt'); // don't log the load balancer keep alive pings
}
};
app.use(logger('dev', morganOptions));
According to the morgan doc, returning TRUE to the skip function should cause the log skip. However, morgan is logging every keep-alive fetch. What am I doing wrong?
via RustyB
No comments:
Post a Comment