diff --git a/CHANGES.md b/CHANGES.md index c369f354c..c0a923087 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ ## Not Yet Released +- #478 Add `req.timers` to audit logging plugin. - #487 RequestCaptureStream: dumpDefault, haveNonRawStreams, zero ring after dump - #407 - bunyan 0.21.3 - Add CSV/TSV parser (Dominik Lessel) diff --git a/lib/plugins/audit.js b/lib/plugins/audit.js index d1489c2b4..eae888e86 100644 --- a/lib/plugins/audit.js +++ b/lib/plugins/audit.js @@ -31,6 +31,13 @@ function auditLogger(options) { if (!req) return (false); + var timers = {}; + (req.timers || []).forEach(function (time) { + var t = time.time; + var _t = Math.floor((1000000 * t[0]) + + (t[1] / 1000)); + timers[time.name] = _t; + }); return ({ method: req.method, url: req.url, @@ -39,7 +46,8 @@ function auditLogger(options) { trailers: req.trailers, version: req.version, body: options.body === true ? - req.body : undefined + req.body : undefined, + timers: timers }); }, res: function auditResponseSerializer(res) {