From d1962820399977ff3a16bfd0a6925125655a56f9 Mon Sep 17 00:00:00 2001 From: malikcherfi Date: Thu, 21 May 2026 09:30:34 +0200 Subject: [PATCH 01/18] fix package name --- python-api/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-api/requirements.txt b/python-api/requirements.txt index b6f3435..8e4cbd6 100644 --- a/python-api/requirements.txt +++ b/python-api/requirements.txt @@ -1,2 +1,2 @@ # BUG 1 — Le nom du paquet ci-dessous est incorrect. Lisez attentivement. -flaskk==3.0.0 +flask==3.0.0 From 641920437f4963e227db95f63c39f5684fe8fb1a Mon Sep 17 00:00:00 2001 From: malikcherfi Date: Thu, 21 May 2026 09:44:04 +0200 Subject: [PATCH 02/18] Fix function - add ":" --- python-api/app.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/python-api/app.py b/python-api/app.py index 2505f77..2fe6542 100644 --- a/python-api/app.py +++ b/python-api/app.py @@ -5,8 +5,10 @@ app = Flask(__name__) # Chargement de la configuration partagée (config.json à la racine du projet) -config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'config.json') -with open(config_path, 'r') as f: +config_path = os.path.join( + os.path.dirname(os.path.abspath(__file__)), "..", "config.json" +) +with open(config_path, "r") as f: config = json.load(f) # ------------------------------------------------------- @@ -14,8 +16,9 @@ # le nombre d'erreurs, warnings et infos détectés. # ------------------------------------------------------- + # BUG 2 — Il manque un caractère essentiel à la fin de cette ligne -def parse_logs(filepath) +def parse_logs(filepath): erreurs = [] warnings = [] infos = [] @@ -39,7 +42,7 @@ def parse_logs(filepath) "warning_count": len(warnings), "info_count": len(infos), "errors": erreurs, - "warnings": warnings + "warnings": warnings, } From ccc3a34cccaf0a4f9c85013c691dd8f16b1786f8 Mon Sep 17 00:00:00 2001 From: malikcherfi Date: Thu, 21 May 2026 09:53:57 +0200 Subject: [PATCH 03/18] import server.log as log_file --- python-api/app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python-api/app.py b/python-api/app.py index 2fe6542..9241e8e 100644 --- a/python-api/app.py +++ b/python-api/app.py @@ -8,6 +8,7 @@ config_path = os.path.join( os.path.dirname(os.path.abspath(__file__)), "..", "config.json" ) +log_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), ".", "server.log") with open(config_path, "r") as f: config = json.load(f) From c880893817299f10b1d74122866e242e84641719 Mon Sep 17 00:00:00 2001 From: malikcherfi Date: Thu, 21 May 2026 09:57:33 +0200 Subject: [PATCH 04/18] fix variable syntax --- python-api/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-api/app.py b/python-api/app.py index 9241e8e..db0c023 100644 --- a/python-api/app.py +++ b/python-api/app.py @@ -32,7 +32,7 @@ def parse_logs(filepath): # BUG 3 — Le nom de la variable utilisée ici ne correspond pas # à celle déclarée plus haut dans cette fonction if "ERROR" in line: - errors.append(line) + erreurs.append(line) elif "WARNING" in line: warnings.append(line) elif "INFO" in line: From 04fb8f845f6efe4a6e3c45d9e29f85e19198c778 Mon Sep 17 00:00:00 2001 From: malikcherfi Date: Thu, 21 May 2026 10:02:18 +0200 Subject: [PATCH 05/18] fix axios name --- node-client/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-client/package.json b/node-client/package.json index ea94ac5..84280d9 100644 --- a/node-client/package.json +++ b/node-client/package.json @@ -7,6 +7,6 @@ "start": "node app.js" }, "dependencies": { - "axioss": "^1.6.0" + "axios": "^1.6.0" } } From aeecbd2dee7258f85a9fe866216d549fcb5ebaac Mon Sep 17 00:00:00 2001 From: malikcherfi Date: Thu, 21 May 2026 10:06:20 +0200 Subject: [PATCH 06/18] fix axios name --- node-client/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node-client/app.js b/node-client/app.js index 6fbf5cf..85879ca 100644 --- a/node-client/app.js +++ b/node-client/app.js @@ -9,11 +9,11 @@ const config = require(path.join(__dirname, '..', 'config.json')); const API_URL = `http://${config.api.host}:${config.api.port}${config.api.route}`; // BUG 6 — Le nom du module importé ici est incorrect -const axioss = require('axioss'); +const axios = require('axios'); async function getLogs() { try { - const response = await axioss.get(API_URL); + const response = await axios.get(API_URL); // BUG 7 — La propriété pour accéder au corps de la réponse avec axios // ne s'appelle pas .body — cherchez dans la doc axios comment From a89a5fce36809bc6791c2ca6c94bebd348b4cc4e Mon Sep 17 00:00:00 2001 From: malikcherfi Date: Thu, 21 May 2026 10:24:52 +0200 Subject: [PATCH 07/18] fix object name --- node-client/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-client/app.js b/node-client/app.js index 85879ca..df15b0e 100644 --- a/node-client/app.js +++ b/node-client/app.js @@ -18,7 +18,7 @@ async function getLogs() { // BUG 7 — La propriété pour accéder au corps de la réponse avec axios // ne s'appelle pas .body — cherchez dans la doc axios comment // accéder aux données de la réponse - const data = response.body; + const data = response.data; console.log('\n========================================'); console.log(' RAPPORT D\'ANALYSE DES LOGS AZURE '); From 55857e21454eb82eb55aade94a9d4854acf1d796 Mon Sep 17 00:00:00 2001 From: malikcherfi Date: Thu, 21 May 2026 10:54:59 +0200 Subject: [PATCH 08/18] fix port number --- config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json b/config.json index b18c09b..c62f739 100644 --- a/config.json +++ b/config.json @@ -3,7 +3,7 @@ "promotion": "DevSecOps Azure — Simplon", "apprenants": [], "api": { - "port": 50001, + "port": 5000, "host": "localhost", "route": "/api/logs", "log_file": "server.log" From e17fd9ac07738729fd6f25bbb80e9eeeda8f86ec Mon Sep 17 00:00:00 2001 From: malikcherfi Date: Thu, 21 May 2026 11:32:47 +0200 Subject: [PATCH 09/18] update port number --- config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json b/config.json index c62f739..5323202 100644 --- a/config.json +++ b/config.json @@ -3,7 +3,7 @@ "promotion": "DevSecOps Azure — Simplon", "apprenants": [], "api": { - "port": 5000, + "port": 5001, "host": "localhost", "route": "/api/logs", "log_file": "server.log" From 8ba8d585efa43a61261e46bf5a123a66aa47c2eb Mon Sep 17 00:00:00 2001 From: malikcherfi Date: Thu, 21 May 2026 11:39:34 +0200 Subject: [PATCH 10/18] Add node_modules to gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9a687c7..3c7ea87 100644 --- a/.gitignore +++ b/.gitignore @@ -43,4 +43,5 @@ terraform.rc # Uncomment the line below if you want to ignore planout files. # planout -.DS_Store \ No newline at end of file +.DS_Store +node-client/node_modules/ \ No newline at end of file From 72d0b3bab7d6b58f36a92bd1b58f2492291b41f4 Mon Sep 17 00:00:00 2001 From: malikcherfi Date: Thu, 21 May 2026 11:42:01 +0200 Subject: [PATCH 11/18] fix path --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3c7ea87..f160c52 100644 --- a/.gitignore +++ b/.gitignore @@ -44,4 +44,4 @@ terraform.rc # planout .DS_Store -node-client/node_modules/ \ No newline at end of file +node_modules/ \ No newline at end of file From a389c482603183b011ad9a75f089df56784d0a29 Mon Sep 17 00:00:00 2001 From: malikcherfi Date: Thu, 21 May 2026 11:55:00 +0200 Subject: [PATCH 12/18] re install dependencies with node_modules in gitignore --- node-client/package-lock.json | 346 ++++++++++++++++++++++++++++++++++ 1 file changed, 346 insertions(+) create mode 100644 node-client/package-lock.json diff --git a/node-client/package-lock.json b/node-client/package-lock.json new file mode 100644 index 0000000..6fc99fe --- /dev/null +++ b/node-client/package-lock.json @@ -0,0 +1,346 @@ +{ + "name": "log-analyser-client", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "log-analyser-client", + "version": "1.0.0", + "dependencies": { + "axios": "^1.6.0" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, + "node_modules/axios": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.16.1.tgz", + "integrity": "sha512-caYkukvroVPO8KrzuJEb50Hm07KwfBZPEC3VeFHTsqWHvKTsy54hjJz9BS/cdaypROE2rH6xvm9mHX4fgWkr3A==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.16.0", + "form-data": "^4.0.5", + "https-proxy-agent": "^5.0.1", + "proxy-from-env": "^2.1.0" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/follow-redirects": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz", + "integrity": "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz", + "integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.3.tgz", + "integrity": "sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/proxy-from-env": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-2.1.0.tgz", + "integrity": "sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==", + "license": "MIT", + "engines": { + "node": ">=10" + } + } + } +} From 10c7dcdc552aef5dfe74eb2979c58cb06c6b2f0f Mon Sep 17 00:00:00 2001 From: malikcherfi Date: Thu, 21 May 2026 14:42:05 +0200 Subject: [PATCH 13/18] Add email-templates.md to gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f160c52..ad12a56 100644 --- a/.gitignore +++ b/.gitignore @@ -44,4 +44,5 @@ terraform.rc # planout .DS_Store -node_modules/ \ No newline at end of file +node_modules/ +email-templates.md \ No newline at end of file From b36257418532a91d611df245ea8a492b95cc9cc8 Mon Sep 17 00:00:00 2001 From: malikcherfi Date: Thu, 21 May 2026 14:44:52 +0200 Subject: [PATCH 14/18] fix file name --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ad12a56..4c56b80 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,4 @@ terraform.rc .DS_Store node_modules/ -email-templates.md \ No newline at end of file +email-template.md \ No newline at end of file From 405e70ce990d7343928525ecf88e1c8b7a7b924f Mon Sep 17 00:00:00 2001 From: malikcherfi Date: Thu, 21 May 2026 14:49:05 +0200 Subject: [PATCH 15/18] remove commentary --- node-client/app.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/node-client/app.js b/node-client/app.js index df15b0e..47cf0a2 100644 --- a/node-client/app.js +++ b/node-client/app.js @@ -4,20 +4,15 @@ const path = require('path'); // Configuration partagée chargée depuis config.json (à la racine du projet) -// BUG 5 (suite) — Si l'API Python ne répond pas, vérifiez le port dans config.json const config = require(path.join(__dirname, '..', 'config.json')); const API_URL = `http://${config.api.host}:${config.api.port}${config.api.route}`; -// BUG 6 — Le nom du module importé ici est incorrect const axios = require('axios'); async function getLogs() { try { const response = await axios.get(API_URL); - // BUG 7 — La propriété pour accéder au corps de la réponse avec axios - // ne s'appelle pas .body — cherchez dans la doc axios comment - // accéder aux données de la réponse const data = response.data; console.log('\n========================================'); From 573c181559750fbed50d9bc9ab910428c1b0cc62 Mon Sep 17 00:00:00 2001 From: malikcherfi Date: Thu, 21 May 2026 14:49:08 +0200 Subject: [PATCH 16/18] remove commentary --- python-api/app.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/python-api/app.py b/python-api/app.py index db0c023..88e9b31 100644 --- a/python-api/app.py +++ b/python-api/app.py @@ -18,7 +18,6 @@ # ------------------------------------------------------- -# BUG 2 — Il manque un caractère essentiel à la fin de cette ligne def parse_logs(filepath): erreurs = [] warnings = [] @@ -29,8 +28,7 @@ def parse_logs(filepath): line = line.strip() if not line: continue - # BUG 3 — Le nom de la variable utilisée ici ne correspond pas - # à celle déclarée plus haut dans cette fonction + if "ERROR" in line: erreurs.append(line) elif "WARNING" in line: @@ -49,13 +47,11 @@ def parse_logs(filepath): @app.route("/api/logs", methods=["GET"]) def get_logs(): - # BUG 4 — La variable passée en argument n'est définie nulle part - # Quel fichier de logs doit-on analyser ? + result = parse_logs(log_file) return jsonify(result), 200 if __name__ == "__main__": - # Le port est chargé depuis config.json - # BUG 5 — Le port est défini dans config.json — est-il correct ? + app.run(debug=True, port=config["api"]["port"]) From 1213b9202d31facf8fbec3a6beca8e6be81b16dc Mon Sep 17 00:00:00 2001 From: malikcherfi Date: Thu, 21 May 2026 16:51:40 +0200 Subject: [PATCH 17/18] fix variable name --- python-api/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-api/app.py b/python-api/app.py index f34d66f..9be91f6 100644 --- a/python-api/app.py +++ b/python-api/app.py @@ -29,7 +29,7 @@ def parse_logs(filepath): if not line: continue if "ERROR" in line: - erreurs.append(line) + errors.append(line) elif "WARNING" in line: warnings.append(line) elif "INFO" in line: From 09746671b3e52ef775cb100be2d8b54e901e35d7 Mon Sep 17 00:00:00 2001 From: malikcherfi Date: Fri, 22 May 2026 09:07:28 +0200 Subject: [PATCH 18/18] update email-template --- email-template.md | 119 ++++++++++++++++++++++++++++++---------------- 1 file changed, 78 insertions(+), 41 deletions(-) diff --git a/email-template.md b/email-template.md index dc7a939..d098a5e 100644 --- a/email-template.md +++ b/email-template.md @@ -1,58 +1,55 @@ # Template — Rapport de débogage par email -> Complétez chaque section entre crochets [ ]. Supprimez les instructions en italique avant d'envoyer. - --- -**À :** responsable.technique@azuretech.fr -**De :** [votre.prenom.nom@azuretech.fr] -**Objet :** [À compléter — soyez précis et professionnel, ex: "Rapport de correction — scripts d'analyse de logs Azure"] -**Date :** [date du jour] +**À :** jean.technique@azuretech.fr +**De :** malik.cherfi@azuretech.fr +**Objet :** Rapport de correction — scripts d'analyse de logs Azure +**Date :** 21/05/2026 --- -Bonjour [Prénom du responsable], +Bonjour Jean, **1. Contexte** -[Décrivez en 2-3 phrases : quel projet, quels scripts étaient en erreur, dans quel environnement vous avez travaillé] +J'ai travaillé avec flask nodejs et vscode, les erreurs se trouvé principalement côté serveur dans le fichier app.py et côté client dans le fichier app.js. +Le projet à pour but de prendre un fichier en paramètre, de dispatcher les messages dans différente clé en fonction du type du message ( côté de serveur ) et de l'envoyé au client pour qu'il affiche les logs. --- **2. Bugs identifiés** -*Projet Python — `python-api/` :* +_Projet Python — `python-api/` :_ -| # | Fichier | Ligne | Type d'erreur | Description du problème | -|---|---------|-------|---------------|--------------------------| -| 1 | | | | | -| 2 | | | | | -| 3 | | | | | -| 4 | | | | | -| 5 | | | | | +| # | Fichier | Ligne | Type d'erreur | Description du problème | +| --- | ---------------- | ----- | ------------------ | ---------------------------------------- | +| 1 | requirements.txt | 2 | SyntaxError | Erreur de syntaxe dans le mot flask | +| 2 | app.py | 18 | SyntaxError | Il manque ":" pour définir la fonction | +| 3 | app.py | 54 | VariableNotDefined | La variable log_file n'était pas définie | +| 4 | app.py | 35 | SyntaxError | Le nom de la variable n'était pas le bon | +| 5 | config.json | 6 | SyntaxError | Le numéro du port n'était pas le bon | -*Projet Node.js — `node-client/` :* +_Projet Node.js — `node-client/` :_ -| # | Fichier | Ligne | Type d'erreur | Description du problème | -|---|---------|-------|---------------|--------------------------| -| 1 | | | | | -| 2 | | | | | -| 3 | | | | | +| # | Fichier | Ligne | Type d'erreur | Description du problème | +| --- | ------------ | ----- | ------------- | ---------------------------------------------------- | +| 1 | package.json | 10 | SyntaxError | Erreur de syntaxe dans le nom de la dépendance axios | +| 2 | app.js | 12,16 | SyntaxError | Erreur de syntaxe dans le nom de la variable axios | +| 3 | app.js | 21 | SyntaxError | Erreur dans le nom de l'objet | --- **3. Corrections apportées** -[Pour chaque bug, expliquez en une phrase ce que vous avez changé ET pourquoi c'est correct.] - -- Bug 1 : -- Bug 2 : -- Bug 3 : -- Bug 4 : -- Bug 5 : -- Bug 6 : -- Bug 7 : -- Bug 8 : +- Bug 1 : J'ai enlevé le 's' en trop dans flassk car le nom correct est flask +- Bug 2 : J'ai ajouté ':' car pour définir une fonction dans Python il faut ajouter les ':' +- Bug 3 : J'ai importé le fichier server.log avec le nom de variable log_file +- Bug 4 : J'ai corrigé le nom de la variable pour qu'elle corresponde au tableau 'erreurs' +- Bug 5 : J'ai corrigé le numéro du port pour m'accorder à la doc ( 50001 => 5000 ) +- Bug 6 : J'ai corrigé le nom la dépendance axios +- Bug 7 : J'ai corrigé le nom de la variable et de l'import de la dépendance axios ( nom de la variable doit être le même que la dépendance pour plus de lisibilité ) +- Bug 8 : J'ai corrigé le nom de l'objet, le serveur renvoi un objet dans lequel il y a une clé appelé data et non body --- @@ -61,30 +58,70 @@ Bonjour [Prénom du responsable], [Décrivez les commandes que vous avez exécutées pour confirmer que tout fonctionne. Incluez le résultat attendu vs le résultat obtenu.] -- Commande testée : +- Commande testée : python3 app.py && node app.js - Résultat obtenu : + +``` +======================================== + RAPPORT D'ANALYSE DES LOGS AZURE +======================================== + Erreurs detectees : 5 + Avertissements : 4 + Messages info : 10 + +--- Detail des erreurs --- + > 2024-01-15 08:02:45 ERROR Failed to connect to Azure Storage: connection timeout + > 2024-01-15 08:05:33 ERROR Authentication failed for service account: deploy_svc + > 2024-01-15 08:07:42 ERROR Database query timeout after 30s on table: audit_logs + > 2024-01-15 08:09:00 ERROR Max retries exceeded - Azure Storage service unavailable + > 2024-01-15 08:12:45 ERROR Backup failed: insufficient permissions on /var/backup/azure + +--- Detail des avertissements --- + > 2024-01-15 08:01:22 WARNING High memory usage detected: 78% + > 2024-01-15 08:06:15 WARNING CPU usage spike detected: 92% + > 2024-01-15 08:10:15 WARNING Disk space below threshold: 15% remaining on /dev/sda1 + > 2024-01-15 08:16:30 WARNING SSL certificate expires in 14 days for api.azuretech.fr +======================================== +``` + - Résultat attendu : -- Validation : ✅ / ❌ + +``` +======================================== + RAPPORT D'ANALYSE DES LOGS AZURE +======================================== + Erreurs detectees : 5 + Avertissements : 4 + Messages info : 10 + +--- Detail des erreurs --- + > 2024-01-15 08:02:45 ERROR Failed to connect to Azure Storage: connection timeout + > 2024-01-15 08:05:33 ERROR Authentication failed for service account: deploy_svc + > 2024-01-15 08:07:42 ERROR Database query timeout after 30s on table: audit_logs + > 2024-01-15 08:09:00 ERROR Max retries exceeded - Azure Storage service unavailable + > 2024-01-15 08:12:45 ERROR Backup failed: insufficient permissions on /var/backup/azure +======================================== +``` + +- Validation : ✅ --- **5. Lien vers la Pull Request** -[Insérez ici l'URL complète de votre PR GitHub] +https://github.com/DevSecOps-Simplon-Training/tp-collaboratif-git-dev-starter/pull/2 --- **6. Recommandations** -[Proposez 1 ou 2 bonnes pratiques à adopter pour éviter ce type de bug à l'avenir.] +Toute les erreurs sont du à de la négligence, il est fortement conseillé de configurer eslint pour détecter le genre d'erreur quand une variable n'est pas défini ou qu'une fonction n'est pas bien écrite. - -- - ---- +- *** Cordialement, -[Prénom Nom] +Malik Cherfi Développeur DevSecOps — Promotion Azure, Simplon -[votre.email@azuretech.fr] +malik.cherfi@azuretech.fr