From 30cf0bdbb88c304035e075b7ef3c39360aad9bf6 Mon Sep 17 00:00:00 2001 From: Eugenio Marzo Date: Thu, 29 Dec 2022 14:09:13 +0100 Subject: [PATCH] fix --- html5/index.html | 3 ++- html5/kubeinvaders.js | 14 +++++--------- scripts/logs_loop/start.py | 9 +++------ 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/html5/index.html b/html5/index.html index f6b3c02..8ace15e 100644 --- a/html5/index.html +++ b/html5/index.html @@ -264,7 +264,6 @@ experiments: -
@@ -351,6 +350,7 @@ experiments: diff --git a/html5/kubeinvaders.js b/html5/kubeinvaders.js index f7e1077..09d1c1e 100644 --- a/html5/kubeinvaders.js +++ b/html5/kubeinvaders.js @@ -182,15 +182,11 @@ function getChaosJobsLogs() { var oReq = new XMLHttpRequest(); oReq.onreadystatechange = function () { if (this.readyState === XMLHttpRequest.DONE && this.status === 200) { - if (programming_mode_switch) { - document.getElementById("chaosJobLogsDiv").innerHTML = ""; - document.getElementById("chaosJobLogsDiv").innerHTML = this.responseText; - } - if (log_tail_switch) { - document.getElementById("logTailDiv").innerHTML = ""; - document.getElementById("logTailDiv").innerHTML = this.responseText; - } - } + if (log_tail_switch) { + document.getElementById("logTailDiv").innerHTML = ""; + document.getElementById("logTailDiv").innerHTML = this.responseText; + } + } };; oReq.open("GET", "https://" + clu_endpoint + "/chaoslogs-" + random_code + ".html"); oReq.send(); diff --git a/scripts/logs_loop/start.py b/scripts/logs_loop/start.py index 8ec436e..b97bd64 100644 --- a/scripts/logs_loop/start.py +++ b/scripts/logs_loop/start.py @@ -26,11 +26,6 @@ def compute_line(api_response_line, api_instance, container): #store = False sha256log = sha256(logrow.encode('utf-8')).hexdigest() - #if r.exists(f"log:{logid}:{pod.metadata.name}:{sha256log}"): - # current_row = r.get(f"log:{logid}:{pod.metadata.name}:{sha256log}") - # if current_row != logrow: - # store = True - if not r.exists(f"log:{logid}:{pod.metadata.name}:{sha256log}"): logging.info(f"[logid:{logid}] The key log:{logid}:{pod.metadata.name}:{sha256log} does not exists. Preparing to store log content") file = pathlib.Path('/var/www/html') @@ -75,7 +70,9 @@ def line_prepender(filename, line, logid): logging.info(f"[logid:{logid}] Some i/o problem occurred in function line_prepender") # create logger -logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO")) +logging.basicConfig(level=logging.INFO) +#logging.basicConfig(filename='/tmp/example.log', encoding='utf-8', level=os.environ.get("LOGLEVEL", "INFO")) + logging.info('Starting script for KubeInvaders taking logs from pods...') file = pathlib.Path('/tmp/redis.sock')