From 28f70f687789db62569182e3f0a11933c5b4206d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Thu, 23 Jul 2020 14:01:34 +0200 Subject: [PATCH] Logger: rename key 'msg' => 'event_message' --- lib/api/api-router.js | 3 ++- lib/api/middlewares/profiler.js | 2 +- lib/utils/logger.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/api/api-router.js b/lib/api/api-router.js index 473dbcb1..2e6b7153 100644 --- a/lib/api/api-router.js +++ b/lib/api/api-router.js @@ -239,7 +239,8 @@ function createTemplateMaps ({ redisPool, surrogateKeysCache, logger }) { return logger.error({ exception: err, 'cdb-user': user, template_id: templateName }, 'Named map invalidation failed'); } - logger.info({ 'cdb-user': user, template_id: templateName, duration: (Date.now() - startTime) / 1000 }, 'Named map invalidation success'); + const elapsed = Date.now() - startTime; + logger.info({ 'cdb-user': user, template_id: templateName, duration: elapsed / 1000, duration_ms: elapsed }, 'Named map invalidation success'); }); } diff --git a/lib/api/middlewares/profiler.js b/lib/api/middlewares/profiler.js index 163046b6..88dc4e8c 100644 --- a/lib/api/middlewares/profiler.js +++ b/lib/api/middlewares/profiler.js @@ -22,7 +22,7 @@ module.exports = function profiler (options) { req.profiler.done('response'); req.profiler.end(); const stats = req.profiler.toJSON(); - logger.info({ stats, duration: stats.response / 1000 }, 'Request profiling stats'); + logger.info({ stats, duration: stats.response / 1000, duration_ms: stats.response }, 'Request profiling stats'); try { // May throw due to dns, see: http://github.com/CartoDB/Windshaft/issues/166 diff --git a/lib/utils/logger.js b/lib/utils/logger.js index 0f949858..f47f9634 100644 --- a/lib/utils/logger.js +++ b/lib/utils/logger.js @@ -24,7 +24,7 @@ module.exports = class Logger { return { levelname: label }; } }, - messageKey: 'message', + messageKey: 'event_message', timestamp: () => `,"timestamp":"${new Date(Date.now()).toISOString()}"`, serializers: { client_request: requestSerializer,