diff --git a/src/components/doclive/AdhocView.vue b/src/components/doclive/AdhocView.vue
index 32a7c75..9790a02 100644
--- a/src/components/doclive/AdhocView.vue
+++ b/src/components/doclive/AdhocView.vue
@@ -95,7 +95,7 @@
-
History of all app logs (redis, readmongo, dummy)
+
History of all app logs
{
+ this.chartOptions.series.push({
+ name: val.name,
+ data: [val.lengtho, val.lengthe],
+ });
+ });
} else {
- this.chartOptions.series.push(
- {
- name: "Readmongo service",
- data: [appout, apperror],
- },
- {
- name: "MongoDB",
- data: [mongol, mongoerror],
- },
- {
- name: "Redis",
- data: [redis, 0],
- },
- {
- name: "Dummy",
- data: [dumout, dumerr],
- }
- );
+ console.log(res["data"]);
+ res["data"].forEach((val) => {
+ this.chartOptions.series.push({
+ name: val.name,
+ data: [val.lengtho, val.lengthe],
+ });
+ });
}
+ //new code end
},
socketconnect() {
//asd
diff --git a/src/components/doclive/runLlo.vue b/src/components/doclive/runLlo.vue
index 92cf893..cda1d91 100644
--- a/src/components/doclive/runLlo.vue
+++ b/src/components/doclive/runLlo.vue
@@ -483,6 +483,14 @@ export default {
console.log("User: " + data.user + " Token: " + data.token);
this.$socket.client.emit("onevent", data.user);
},
+ async IsJsonString(str) {
+ try {
+ JSON.parse(str);
+ } catch (e) {
+ return false;
+ }
+ return true;
+ },
async checktoken(value) {
try {
var token = value;
@@ -744,7 +752,7 @@ export default {
created() {
//var logintoken = new URL(location.href).searchParams.get("token");
var logintoken = new URL(
- "https://api-client.swarmlab.io:8088/?token=9312e5629b22cfdc7c5ca027be3cc85f91bbdb58"
+ "https://api-client.swarmlab.io:8088/?token=f1b58f173301b2b8d052cac205d4438d283b1e33"
).searchParams.get("token");
this.logintoken = logintoken;
// === We get the user + check for the token if exists
@@ -995,11 +1003,6 @@ export default {
// Lefos --- socket event to add the data to the right tables
async logsend(val) {
// ==== LEFOS
- // console.log(" socket message " + JSON.stringify(val));
-
- // var log = val.log;
- // console.log(" LOG: " + JSON.parse(JSON.stringify(log)));
-
//Check which data array to put as data to the tables
this.checklogs();
@@ -1009,10 +1012,12 @@ export default {
val.container_id = '' + val.container_id + "
";
// console.log("raw before.. " + val.log);
+
// A bit of edit to fit perfectly into the table
val.log = val.log.replace(/,/g, ", ");
val.log = val.log.replace(/":/g, '": ');
// console.log("raw after .. " + val.log);
+
// Change color of source for ALL RAW table to be able to see the error logs easy
if (val.source == "stdout") {
val.source = '' + val.source + "
";
@@ -1026,7 +1031,7 @@ export default {
this.rawdata.push(val);
// Check if the log is by a node_service and change color of the type field
- if (val.log.includes("app_name")) {
+ if (val.tag.includes("node") && this.IsJsonString(val.log)) {
var test = JSON.parse(val.log);
if (test.type == "out") {
test.type = '' + test.type + "
";
@@ -1037,7 +1042,7 @@ export default {
}
this.localData.push(test);
} //check if the log is by the mongodb and change color
- else if (val.container_name == "/mongo") {
+ else if (val.tag.includes("mongodb")) {
// ========== push data for raw table ============
var tmp = JSON.parse(val.log);
@@ -1064,13 +1069,13 @@ export default {
timestamp: time,
type: "out
",
process_id: "Unknown",
- app_name: "Mongo",
+ app_name: val.container_name,
};
this.localDataOut.push(tmp);
this.localData.push(tmp);
// console.log("HEY " + JSON.stringify(test));
- } else if (val.container_name == "/redisserver") {
+ } else if (val.tag.includes("redis")) {
var tmplog = val;
//timestamp
var time = tmplog.time;
@@ -1079,7 +1084,7 @@ export default {
timestamp: time,
type: "out
",
process_id: "Unknown",
- app_name: "redis",
+ app_name: val.container_name,
};
this.localDataOut.push(tmp);