This commit is contained in:
Luckysideburn
2022-10-27 19:02:45 +00:00
parent d1f95f6023
commit f25934d381
2 changed files with 7 additions and 6 deletions
+4 -3
View File
@@ -31,6 +31,7 @@ var programming_mode_buttons = document.getElementById("programming-mode-buttons
var log_tail_switch = false;
var log_tail_div = document.getElementById("logTailDiv");
var log_tail_screen = document.getElementById("logTailScreen");
var random_code = (Math.random() + 1).toString(36).substring(7);
// nodes list from kubernetes
var nodes = [];
@@ -143,7 +144,7 @@ function getChaosJobsLogs() {
}
}
};;
oReq.open("GET", "https://" + clu_endpoint + "/chaoslogs.html");
oReq.open("GET", "https://" + clu_endpoint + "/chaoslogs" + random_code + ".html");
oReq.send();
}
@@ -193,7 +194,7 @@ function getCurrentChaosContainer() {
function enableLogTail() {
var oReq = new XMLHttpRequest();
oReq.open("POST", "https://" + clu_endpoint + "/kube/chaos/containers?action=enable_log_tail", true);
oReq.open("POST", "https://" + clu_endpoint + "/kube/chaos/containers?action=enable_log_tail&id=" + random_code, true);
oReq.onreadystatechange = function () {
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
$('#alert_placeholder3').replaceWith(log_tail_alert + 'Logs tail started </div>');
@@ -206,7 +207,7 @@ function enableLogTail() {
function disableLogTail() {
var oReq = new XMLHttpRequest();
oReq.open("POST", "https://" + clu_endpoint + "/kube/chaos/containers?action=disable_log_tail", true);
oReq.open("POST", "https://" + clu_endpoint + "/kube/chaos/containers?action=disable_log_tail=id" + random_code, true);
oReq.onreadystatechange = function () {
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
$('#alert_placeholder3').replaceWith(log_tail_alert + 'Logs tail stopped </div>');
+3 -3
View File
@@ -36,20 +36,20 @@ elseif ngx.var.request_method == "POST" and action == 'set' then
elseif ngx.var.request_method == "POST" and action == "set_log_regex" then
local body_data = ngx.req.get_body_data()
red:set("log_pod_regex", body_data)
red:set("log_pod_regex:" .. arg['id'], body_data)
os.execute("> /var/www/html/chaoslogs.html")
ngx.say("New container definition has been saved in Redis => " .. body_data)
return ngx.exit(ngx.status)
elseif ngx.var.request_method == "POST" and action == "enable_log_tail" then
local body_data = ngx.req.get_body_data()
red:set("logs_enabled", "1")
red:set("logs_enabled:" .. arg['id'], "1")
os.execute("> /var/www/html/chaoslogs.html")
ngx.say("Enable Log Tail")
return ngx.exit(ngx.status)
elseif ngx.var.request_method == "POST" and action == "disable_log_tail" then
red:set("logs_enabled", "0")
red:set("logs_enabled:" .. arg['id'], "0")
os.execute("> /var/www/html/chaoslogs.html")
ngx.say("Disable Log Tail")
return ngx.exit(ngx.status)