Commit cfdcd173301bf95e6b89a726443ad6bb0ae60039
1 parent
a1b90a1d7d
Exists in
master
and in
1 other branch
Log process id
Showing 1 changed file with 1 additions and 0 deletions Inline Diff
lib/middlewares/common.js
1 | const uuidv1 = require('uuid/v1'); | 1 | const uuidv1 = require('uuid/v1'); |
2 | const logger = require('komodo-sdk/logger'); | 2 | const logger = require('komodo-sdk/logger'); |
3 | 3 | ||
4 | module.exports = function common(req, res, next) { | 4 | module.exports = function common(req, res, next) { |
5 | if (req.url.search('/favicon.ico') === 0) { | 5 | if (req.url.search('/favicon.ico') === 0) { |
6 | res.sendStatus(404); | 6 | res.sendStatus(404); |
7 | return; | 7 | return; |
8 | } | 8 | } |
9 | 9 | ||
10 | res.locals.xid = uuidv1(); | 10 | res.locals.xid = uuidv1(); |
11 | res.locals.x_http_request_ts = new Date(); | 11 | res.locals.x_http_request_ts = new Date(); |
12 | 12 | ||
13 | logger.info(`Got request from ${res.locals.httpgetx_subsystem === 'CORE-CALLBACK' ? 'CORE' : 'PARTNER'}`, { | 13 | logger.info(`Got request from ${res.locals.httpgetx_subsystem === 'CORE-CALLBACK' ? 'CORE' : 'PARTNER'}`, { |
14 | xid: res.locals.xid, | 14 | xid: res.locals.xid, |
15 | pid: process.pid, | ||
15 | requester_ip: req.ip, | 16 | requester_ip: req.ip, |
16 | method: req.method, | 17 | method: req.method, |
17 | path: req.path, | 18 | path: req.path, |
18 | url: req.url, | 19 | url: req.url, |
19 | qs: req.query, | 20 | qs: req.query, |
20 | body: req.body, | 21 | body: req.body, |
21 | }); | 22 | }); |
22 | next(); | 23 | next(); |
23 | }; | 24 | }; |
24 | 25 |