From bd1c49e478a08f1342c5ec762df90eb335ef5464 Mon Sep 17 00:00:00 2001 From: Tedd Mason Date: Wed, 16 Oct 2024 08:10:53 +0100 Subject: [PATCH] SIR-1075 Updating logging --- package-lock.json | 8 ++++---- package.json | 2 +- server/plugins/logging.js | 20 ++++++++++++++++++-- server/utils/config.js | 2 +- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 633e6c0..f845861 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,7 +30,7 @@ "cron-parser": "^4.9.0", "css-loader": "^7.1.2", "govuk-frontend": "^5.7.1", - "hapi-pino": "12.1.0", + "hapi-pino": "^12.1.0", "joi": "^17.13.3", "moment": "^2.30.1", "node-sass": "^9.0.0", @@ -12233,9 +12233,9 @@ } }, "node_modules/safe-stable-stringify": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", - "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz", + "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==", "engines": { "node": ">=10" } diff --git a/package.json b/package.json index ee6ca31..fb1892f 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "cron-parser": "^4.9.0", "css-loader": "^7.1.2", "govuk-frontend": "^5.7.1", - "hapi-pino": "12.1.0", + "hapi-pino": "^12.1.0", "joi": "^17.13.3", "moment": "^2.30.1", "node-sass": "^9.0.0", diff --git a/server/plugins/logging.js b/server/plugins/logging.js index b477034..14e37bc 100644 --- a/server/plugins/logging.js +++ b/server/plugins/logging.js @@ -5,6 +5,22 @@ export default { plugin: HapiPino, options: { logPayload: true, - level: config.logLevel + level: config.logLevel, + redact: { + paths: ['req.headers.authorization', 'req.headers.cookie', 'res.headers'], + remove: true + }, + ignorePaths: [ + '/public/stylesheets/application.css', + '/public/js/core.js', + '/public/js/cookies.js', + '/public/js/locationMap.js', + '/public/govuk-frontend.min.js', + '/public/images/favicon.svg', + '/public/images/govuk-crest.svg', + '/public/manifest.json', + '/public/fonts/light-94a07e06a1-v2.woff2', + '/public/fonts/bold-b542beb274-v2.woff2' + ] } -} +} \ No newline at end of file diff --git a/server/utils/config.js b/server/utils/config.js index 46ce187..f149a3b 100644 --- a/server/utils/config.js +++ b/server/utils/config.js @@ -17,7 +17,7 @@ const schema = Joi.object().keys({ redisPort: Joi.number().default(defaultRedisPort), redisPassword: Joi.string(), redisTls: Joi.bool().default(false), - logLevel: Joi.string().default('warn'), + logLevel: Joi.string().default('info'), sessionCookiePassword: Joi.string().default('the-password-must-be-at-least-32-characters-long'), authCookiePassword: Joi.string().default('the-password-must-be-at-least-32-characters-long'), cookieIsSecure: Joi.bool().default(false),