From d3ea40b69f82a18bb4ceae42d22aa2a01dcbb069 Mon Sep 17 00:00:00 2001 From: lefteris Date: Thu, 30 Sep 2021 16:55:00 +0300 Subject: [PATCH] final --- swarmlab-app/src/run/app.js | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/swarmlab-app/src/run/app.js b/swarmlab-app/src/run/app.js index 1b12bfa2..9726a012 100644 --- a/swarmlab-app/src/run/app.js +++ b/swarmlab-app/src/run/app.js @@ -173,7 +173,10 @@ app.get("/length", cors(corsOptions), (req, res) => { else if (tmp.s == "W" || tmp.s == "E") return "err"; //count every warning and error log } else if (value.tag.includes("node")) { if (IsJsonString(value.log)) var test = JSON.parse(value.log); - else return "none"; + else { + if (value.source == "stdout") return "out"; + else return "err"; + } var type = test.type; if (type == "out") return "out"; @@ -383,6 +386,7 @@ app.get("/test2", cors(corsOptions), (req, res) => { var obj = JSON.parse(JSON.stringify(result)); obj.forEach((value) => { + var test = IsJsonString(value.log); if (value.tag.includes("node") && IsJsonString(value.log)) { var tmp = JSON.parse(value.log); var container_name = value.container_name; @@ -414,6 +418,35 @@ app.get("/test2", cors(corsOptions), (req, res) => { ) { jsonfinal.push(tmp2); } + } else if (value.tag.includes("node") && test == false) { + //console.error("EDW EIMAI!!!!"); + var tmptype; + if (value.source == "stdout") { + tmptype = '
' + "out" + "
"; + } else if (value.source == "stderr") { + tmptype = '
' + "err" + "
"; + } + var tmp2 = { + message: value.log, + timestamp: value.time, + type: tmptype, + process_id: "-", + app_name: value.container_name, + }; + if ( + logtext != "" && + tmp2.message.includes(logtext) && + (value.container_name == selected || selected == "All") + ) { + jsonfinal.push(tmp2); + } else if (logtext != "" && !value.log.includes(logtext)) { + //console.error("lathos sinthiki"); + } else if ( + logtext == "" && + (value.container_name == selected || selected == "All") + ) { + jsonfinal.push(tmp2); + } } else if ( value.tag.includes("redis") && (value.container_name == selected || selected == "All")