|
@ -483,6 +483,14 @@ export default { |
|
|
console.log("User: " + data.user + " Token: " + data.token); |
|
|
console.log("User: " + data.user + " Token: " + data.token); |
|
|
this.$socket.client.emit("onevent", data.user); |
|
|
this.$socket.client.emit("onevent", data.user); |
|
|
}, |
|
|
}, |
|
|
|
|
|
async IsJsonString(str) { |
|
|
|
|
|
try { |
|
|
|
|
|
JSON.parse(str); |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
return true; |
|
|
|
|
|
}, |
|
|
async checktoken(value) { |
|
|
async checktoken(value) { |
|
|
try { |
|
|
try { |
|
|
var token = value; |
|
|
var token = value; |
|
@ -744,7 +752,7 @@ export default { |
|
|
created() { |
|
|
created() { |
|
|
//var logintoken = new URL(location.href).searchParams.get("token"); |
|
|
//var logintoken = new URL(location.href).searchParams.get("token"); |
|
|
var logintoken = new URL( |
|
|
var logintoken = new URL( |
|
|
"https://api-client.swarmlab.io:8088/?token=9312e5629b22cfdc7c5ca027be3cc85f91bbdb58" |
|
|
"https://api-client.swarmlab.io:8088/?token=f1b58f173301b2b8d052cac205d4438d283b1e33" |
|
|
).searchParams.get("token"); |
|
|
).searchParams.get("token"); |
|
|
this.logintoken = logintoken; |
|
|
this.logintoken = logintoken; |
|
|
// === We get the user + check for the token if exists |
|
|
// === 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 |
|
|
// Lefos --- socket event to add the data to the right tables |
|
|
async logsend(val) { |
|
|
async logsend(val) { |
|
|
// ==== LEFOS |
|
|
// ==== 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 |
|
|
//Check which data array to put as data to the tables |
|
|
this.checklogs(); |
|
|
this.checklogs(); |
|
|
|
|
|
|
|
@ -1009,10 +1012,12 @@ export default { |
|
|
|
|
|
|
|
|
val.container_id = '<div class="conid">' + val.container_id + "</div>"; |
|
|
val.container_id = '<div class="conid">' + val.container_id + "</div>"; |
|
|
// console.log("raw before.. " + val.log); |
|
|
// console.log("raw before.. " + val.log); |
|
|
|
|
|
|
|
|
// A bit of edit to fit perfectly into the table |
|
|
// A bit of edit to fit perfectly into the table |
|
|
val.log = val.log.replace(/,/g, ", "); |
|
|
val.log = val.log.replace(/,/g, ", "); |
|
|
val.log = val.log.replace(/":/g, '": '); |
|
|
val.log = val.log.replace(/":/g, '": '); |
|
|
// console.log("raw after .. " + val.log); |
|
|
// console.log("raw after .. " + val.log); |
|
|
|
|
|
|
|
|
// Change color of source for ALL RAW table to be able to see the error logs easy |
|
|
// Change color of source for ALL RAW table to be able to see the error logs easy |
|
|
if (val.source == "stdout") { |
|
|
if (val.source == "stdout") { |
|
|
val.source = '<div class="outtype" >' + val.source + "</div>"; |
|
|
val.source = '<div class="outtype" >' + val.source + "</div>"; |
|
@ -1026,7 +1031,7 @@ export default { |
|
|
this.rawdata.push(val); |
|
|
this.rawdata.push(val); |
|
|
|
|
|
|
|
|
// Check if the log is by a node_service and change color of the type field |
|
|
// 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); |
|
|
var test = JSON.parse(val.log); |
|
|
if (test.type == "out") { |
|
|
if (test.type == "out") { |
|
|
test.type = '<div class="outtype" >' + test.type + "</div>"; |
|
|
test.type = '<div class="outtype" >' + test.type + "</div>"; |
|
@ -1037,7 +1042,7 @@ export default { |
|
|
} |
|
|
} |
|
|
this.localData.push(test); |
|
|
this.localData.push(test); |
|
|
} //check if the log is by the mongodb and change color |
|
|
} //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 ============ |
|
|
// ========== push data for raw table ============ |
|
|
var tmp = JSON.parse(val.log); |
|
|
var tmp = JSON.parse(val.log); |
|
|
|
|
|
|
|
@ -1064,13 +1069,13 @@ export default { |
|
|
timestamp: time, |
|
|
timestamp: time, |
|
|
type: "<div class= 'outtype'>out</div>", |
|
|
type: "<div class= 'outtype'>out</div>", |
|
|
process_id: "Unknown", |
|
|
process_id: "Unknown", |
|
|
app_name: "Mongo", |
|
|
app_name: val.container_name, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
this.localDataOut.push(tmp); |
|
|
this.localDataOut.push(tmp); |
|
|
this.localData.push(tmp); |
|
|
this.localData.push(tmp); |
|
|
// console.log("HEY " + JSON.stringify(test)); |
|
|
// console.log("HEY " + JSON.stringify(test)); |
|
|
} else if (val.container_name == "/redisserver") { |
|
|
} else if (val.tag.includes("redis")) { |
|
|
var tmplog = val; |
|
|
var tmplog = val; |
|
|
//timestamp |
|
|
//timestamp |
|
|
var time = tmplog.time; |
|
|
var time = tmplog.time; |
|
@ -1079,7 +1084,7 @@ export default { |
|
|
timestamp: time, |
|
|
timestamp: time, |
|
|
type: "<div class= 'outtype'>out</div>", |
|
|
type: "<div class= 'outtype'>out</div>", |
|
|
process_id: "Unknown", |
|
|
process_id: "Unknown", |
|
|
app_name: "redis", |
|
|
app_name: val.container_name, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
this.localDataOut.push(tmp); |
|
|
this.localDataOut.push(tmp); |
|
|