
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
restify-log-middleware
Advanced tools
This is a small middleware to use with restify to generate log inside req's using bunyan and elasticsearch modules.
npm install --save restify-log-middleware
...
var logFactory = require('restify-log-middleware');
var options = {
"elasticSearchConfig": {
"indexPattern": "[logstash-]YYYY.MM.DD",
"type": "logs",
"host": "elasticSearchIp:port"
},
"logLevel": 10,
"logName": "myLogName",
"withstdout" : true
};
...
//in your routes config
...
var logMiddleware = logFactory.createLogMiddleware('myModuleName', options);
server.post('/some-endpoint', [
logMiddleware,
myController.post
]);
...
//or
...
server.post('/some-endpoint', [
logFactory.createLogMiddleware('myModuleName', options),
myController.post
]);
...
//or to use with before all routes
server.use(logFactory.createLogMiddleware('myModuleName', options));
//it will generate an req.log object. You can use it like this:
myController(req, res){
var log = req.log
log = log.child(module: 'controller-module'});
log.trace('Controller started!');
...
log.info('Some info');
...
log.warn('Some warning');
...
}
You need to use at least:
As optional, you can set up your own elasticSearch configuration like this:
elasticSearchConfig: {
"indexPattern": "[logstash-]YYYY.MM.DD",
"type": "logs",
"host": "elasticSearchIp:port"
}
If you don't need to use process.stdout
, just turn off this option:
"withstdout" : false
FAQs
Basic log middleware to use with restify
We found that restify-log-middleware demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.